xonecas.io
1361
Xc

xonecas.com / commit de3e4b4

new ignore file

sean2011-10-14 de3e4b47f867538ae37964582278a6bfe34b863c parent 611cce2

186 files changed

This diff is too big to show in full. The first 1000 lines are below, and every file is listed with its counts.

.gitignore+13−1
@@ -1 +1,13 @@
1-*.swp
1+node_modules
2+
3+# Mac stuff
4+.DS_Store
5+._*
6+.Spotlight-V100
7+.Trashes
8+
9+# Vim stuff
10+.*.sw[a-z]
11+*.un~
12+Session.vim
13+
favicon.ico+0−0
Binary file, not shown.
index.html+13−0
@@ -23,6 +23,9 @@ Sean is a computer scientist, student and technology enthusiast. He focuses on w
2323 </p>
2424 </section>
2525
26+ <section id="photos">
27+ </section>
28+
2629 <script id="header_tmpl" type="text/template">
2730 <div class="topbar-inner">
2831 <div class="container">
@@ -77,6 +80,16 @@ Sean is a computer scientist, student and technology enthusiast. He focuses on w
7780 </div>
7881 </script>
7982
83+ <script id="photos_tmpl" type="text/template">
84+ <ul class="media-grid">
85+ <li>
86+ <a href="">
87+
88+ </a>
89+ </li>
90+ </ul>
91+ </script>
92+
8093 <script id="post_tmpl" type="text/template">
8194 <article>
8295 <h1>{{title}}</h1>
js/script.js+19−10
@@ -12,14 +12,8 @@ var xonecas = !function () {
1212 return text;
1313 }
1414
15- var Tumblr = Backbone.Collection.extend({
16- url: "http://api.tumblr.com/v2/blog/xonecas.tumblr.com/posts/text",
17- page: 0,
18- count: 5,
19- idx: 0,
20-
21- initialize: function () {
22- },
15+ var TumblrSync = Backbone.Collection.extend({
16+ type: 'text',
2317
2418 parse: function (res, xhr) {
2519 this.total = Math.ceil(res.response.total_posts/this.count);
@@ -30,6 +24,7 @@ var xonecas = !function () {
3024 var params = _.extend(options, {
3125 "url": this.url,
3226 "data": {
27+ "type": this.type,
3328 "limit": this.count,
3429 "offset": this.page * this.count,
3530 "api_key": "IM11cPEsi3jxTeSNwF8BB9Z08UItXcYKiEDLTLvl5RYn6MBcMD"
@@ -60,6 +55,19 @@ var xonecas = !function () {
6055 }
6156 });
6257
58+ var Photos = TumblrSync.extend({
59+ url: "http://api.tumblr.com/v2/blog/xonecas.tumblr.com/posts/photo",
60+ page: 0,
61+ count: 10,
62+ type: 'photo'
63+ });
64+
65+ var Tumblr = TumblrSync.extend({
66+ url: "http://api.tumblr.com/v2/blog/xonecas.tumblr.com/posts/text",
67+ page: 0,
68+ count: 5
69+ });
70+
6371 var Twitter = Backbone.Collection.extend({
6472 url: "http://api.twitter.com/1/statuses/user_timeline.json",
6573 count: 5,
@@ -178,13 +186,14 @@ var xonecas = !function () {
178186 this.header = new Header({
179187 'collection': this.collection
180188 });
189+ this.photos = new Photos();
190+ this.photos.fetch();
181191 this.footer = new Footer();
182192 _.bindAll(this, "render", "report");
183193 this.collection.bind('reset', this.render);
184194 this.collection.bind('error', this.report);
185195 this.collection.bind('change', this.render);
186196 this.collection.fetch();
187-
188197 this.header.render();
189198 $('body').append(this.el);
190199 this.footer.render();
@@ -208,7 +217,7 @@ var xonecas = !function () {
208217 .html(html)
209218 .fadeIn(1000);
210219
211- if (window.scrollY !== 0) {
220+ if (window.scrollY > 310) {
212221 window.scrollTo(0, 310);
213222 }
214223 hijs('code');
lib/ugly.js+40−0
@@ -0,0 +1,40 @@
1+var
2+ fs = require('fs'),
3+ jsp = require('uglify-js').parser,
4+ pro = require('uglify-js').uglify;
5+
6+function uglify (js) {
7+ var ast = jsp.parse(js);
8+ ast = pro.ast_mangle(ast);
9+ ast = pro.ast_squeeze(ast);
10+ return pro.gen_code(ast);
11+}
12+
13+function parse (directory, callback) {
14+ callback = callback || function () {};
15+
16+ fs.readdir(directory, function (err, files) {
17+ if (err)
18+ return callback(err);
19+
20+ !function _iter () {
21+ var file_path = __dirname +"/"+ files.pop();
22+ if (files.length > 0) {
23+ fs.readFile(file_path, 'utf8', function (err2, js) {
24+ if (err2)
25+ return callback(err2);
26+
27+ var min_path = file_path.replace(".js", ".min.js");
28+ fs.writeFile(min_path, uglify(js), 'utf8', function (err3) {
29+ if (err3)
30+ return callback(err3);
31+
32+ callback(null);
33+ });
34+ });
35+ }
36+ } ();
37+ });
38+}
39+
40+module.exports = parse;
node_modules/connect/.npmignore+0−11
@@ -1,11 +0,0 @@
1-*.markdown
2-*.md
3-.git*
4-Makefile
5-benchmarks/
6-docs/
7-examples/
8-install.sh
9-support/
10-test/
11-.DS_Store
node_modules/connect/LICENSE+0−24
@@ -1,24 +0,0 @@
1-(The MIT License)
2-
3-Copyright (c) 2010 Sencha Inc.
4-Copyright (c) 2011 LearnBoost
5-Copyright (c) 2011 TJ Holowaychuk
6-
7-Permission is hereby granted, free of charge, to any person obtaining
8-a copy of this software and associated documentation files (the
9-'Software'), to deal in the Software without restriction, including
10-without limitation the rights to use, copy, modify, merge, publish,
11-distribute, sublicense, and/or sell copies of the Software, and to
12-permit persons to whom the Software is furnished to do so, subject to
13-the following conditions:
14-
15-The above copyright notice and this permission notice shall be
16-included in all copies or substantial portions of the Software.
17-
18-THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
19-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
node_modules/connect/index.js+0−2
@@ -1,2 +0,0 @@
1-
2-module.exports = require('./lib/connect');
node_modules/connect/lib/connect.js+0−106
@@ -1,106 +0,0 @@
1-
2-/*!
3- * Connect
4- * Copyright(c) 2010 Sencha Inc.
5- * Copyright(c) 2011 TJ Holowaychuk
6- * MIT Licensed
7- */
8-
9-/**
10- * Module dependencies.
11- */
12-
13-var HTTPServer = require('./http').Server
14- , HTTPSServer = require('./https').Server
15- , fs = require('fs');
16-
17-// node patches
18-
19-require('./patch');
20-
21-// expose createServer() as the module
22-
23-exports = module.exports = createServer;
24-
25-/**
26- * Framework version.
27- */
28-
29-exports.version = '1.5.2';
30-
31-/**
32- * Initialize a new `connect.HTTPServer` with the middleware
33- * passed to this function. When an object is passed _first_,
34- * we assume these are the tls options, and return a `connect.HTTPSServer`.
35- *
36- * Examples:
37- *
38- * An example HTTP server, accepting several middleware.
39- *
40- * var server = connect.createServer(
41- * connect.logger()
42- * , connect.static(__dirname + '/public')
43- * );
44- *
45- * An HTTPS server, utilizing the same middleware as above.
46- *
47- * var server = connect.createServer(
48- * { key: key, cert: cert }
49- * , connect.logger()
50- * , connect.static(__dirname + '/public')
51- * );
52- *
53- * Alternatively with connect 1.0 we may omit `createServer()`.
54- *
55- * connect(
56- * connect.logger()
57- * , connect.static(__dirname + '/public')
58- * ).listen(3000);
59- *
60- * @param {Object|Function} ...
61- * @return {Server}
62- * @api public
63- */
64-
65-function createServer() {
66- if ('object' == typeof arguments[0]) {
67- return new HTTPSServer(arguments[0], Array.prototype.slice.call(arguments, 1));
68- } else {
69- return new HTTPServer(Array.prototype.slice.call(arguments));
70- }
71-};
72-
73-// support connect.createServer()
74-
75-exports.createServer = createServer;
76-
77-// auto-load getters
78-
79-exports.middleware = {};
80-
81-/**
82- * Auto-load bundled middleware with getters.
83- */
84-
85-fs.readdirSync(__dirname + '/middleware').forEach(function(filename){
86- if (/\.js$/.test(filename)) {
87- var name = filename.substr(0, filename.lastIndexOf('.'));
88- exports.middleware.__defineGetter__(name, function(){
89- return require('./middleware/' + name);
90- });
91- }
92-});
93-
94-// expose utils
95-
96-exports.utils = require('./utils');
97-
98-// expose getters as first-class exports
99-
100-exports.utils.merge(exports, exports.middleware);
101-
102-// expose constructors
103-
104-exports.HTTPServer = HTTPServer;
105-exports.HTTPSServer = HTTPSServer;
106-
node_modules/connect/lib/http.js+0−212
@@ -1,212 +0,0 @@
1-
2-/*!
3- * Connect - HTTPServer
4- * Copyright(c) 2010 Sencha Inc.
5- * Copyright(c) 2011 TJ Holowaychuk
6- * MIT Licensed
7- */
8-
9-/**
10- * Module dependencies.
11- */
12-
13-var http = require('http')
14- , parse = require('url').parse
15- , assert = require('assert');
16-
17-// environment
18-
19-var env = process.env.NODE_ENV || 'development';
20-
21-/**
22- * Initialize a new `Server` with the given `middleware`.
23- *
24- * Examples:
25- *
26- * var server = connect.createServer(
27- * connect.favicon()
28- * , connect.logger()
29- * , connect.static(__dirname + '/public')
30- * );
31- *
32- * @params {Array} middleware
33- * @return {Server}
34- * @api public
35- */
36-
37-var Server = exports.Server = function HTTPServer(middleware) {
38- this.stack = [];
39- middleware.forEach(function(fn){
40- this.use(fn);
41- }, this);
42- http.Server.call(this, this.handle);
43-};
44-
45-/**
46- * Inherit from `http.Server.prototype`.
47- */
48-
49-Server.prototype.__proto__ = http.Server.prototype;
50-
51-/**
52- * Utilize the given middleware `handle` to the given `route`,
53- * defaulting to _/_. This "route" is the mount-point for the
54- * middleware, when given a value other than _/_ the middleware
55- * is only effective when that segment is present in the request's
56- * pathname.
57- *
58- * For example if we were to mount a function at _/admin_, it would
59- * be invoked on _/admin_, and _/admin/settings_, however it would
60- * not be invoked for _/_, or _/posts_.
61- *
62- * This is effectively the same as passing middleware to `connect.createServer()`,
63- * however provides a progressive api.
64- *
65- * Examples:
66- *
67- * var server = connect.createServer();
68- * server.use(connect.favicon());
69- * server.use(connect.logger());
70- * server.use(connect.static(__dirname + '/public'));
71- *
72- * If we wanted to prefix static files with _/public_, we could
73- * "mount" the `static()` middleware:
74- *
75- * server.use('/public', connect.static(__dirname + '/public'));
76- *
77- * This api is chainable, meaning the following is valid:
78- *
79- * connect.createServer()
80- * .use(connect.favicon())
81- * .use(connect.logger())
82- * .use(connect.static(__dirname + '/public'))
83- * .listen(3000);
84- *
85- * @param {String|Function} route or handle
86- * @param {Function} handle
87- * @return {Server}
88- * @api public
89- */
90-
91-Server.prototype.use = function(route, handle){
92- this.route = '/';
93-
94- // default route to '/'
95- if ('string' != typeof route) {
96- handle = route;
97- route = '/';
98- }
99-
100- // wrap sub-apps
101- if ('function' == typeof handle.handle) {
102- var server = handle;
103- server.route = route;
104- handle = function(req, res, next) {
105- server.handle(req, res, next);
106- };
107- }
108-
109- // wrap vanilla http.Servers
110- if (handle instanceof http.Server) {
111- handle = handle.listeners('request')[0];
112- }
113-
114- // normalize route to not trail with slash
115- if ('/' == route[route.length - 1]) {
116- route = route.substr(0, route.length - 1);
117- }
118-
119- // add the middleware
120- this.stack.push({ route: route, handle: handle });
121-
122- // allow chaining
123- return this;
124-};
125-
126-/**
127- * Handle server requests, punting them down
128- * the middleware stack.
129- *
130- * @api private
131- */
132-
133-Server.prototype.handle = function(req, res, out) {
134- var writeHead = res.writeHead
135- , stack = this.stack
136- , removed = ''
137- , index = 0;
138-
139- function next(err) {
140- var layer, path, c;
141- req.url = removed + req.url;
142- req.originalUrl = req.originalUrl || req.url;
143- removed = '';
144-
145- layer = stack[index++];
146-
147- // all done
148- if (!layer) {
149- // but wait! we have a parent
150- if (out) return out(err);
151-
152- // otherwise send a proper error message to the browser.
153- if (err) {
154- var msg = 'production' == env
155- ? 'Internal Server Error'
156- : err.stack || err.toString();
157-
158- // output to stderr in a non-test env
159- if ('test' != env) console.error(err.stack || err.toString());
160-
161- res.statusCode = 500;
162- res.setHeader('Content-Type', 'text/plain');
163- res.end(msg);
164- } else {
165- res.statusCode = 404;
166- res.setHeader('Content-Type', 'text/plain');
167- res.end('Cannot ' + req.method + ' ' + req.url);
168- }
169- return;
170- }
171-
172- try {
173- path = parse(req.url).pathname;
174- if (undefined == path) path = '/';
175-
176- // skip this layer if the route doesn't match.
177- if (0 != path.indexOf(layer.route)) return next(err);
178-
179- c = path[layer.route.length];
180- if (c && '/' != c && '.' != c) return next(err);
181-
182- // Call the layer handler
183- // Trim off the part of the url that matches the route
184- removed = layer.route;
185- req.url = req.url.substr(removed.length);
186-
187- // Ensure leading slash
188- if ('/' != req.url[0]) req.url = '/' + req.url;
189-
190- var arity = layer.handle.length;
191- if (err) {
192- if (arity === 4) {
193- layer.handle(err, req, res, next);
194- } else {
195- next(err);
196- }
197- } else if (arity < 4) {
198- layer.handle(req, res, next);
199- } else {
200- next();
201- }
202- } catch (e) {
203- if (e instanceof assert.AssertionError) {
204- console.error(e.stack + '\n');
205- next(e);
206- } else {
207- next(e);
208- }
209- }
210- }
211- next();
212-};
node_modules/connect/lib/https.js+0−47
@@ -1,47 +0,0 @@
1-
2-/*!
3- * Connect - HTTPServer
4- * Copyright(c) 2010 Sencha Inc.
5- * Copyright(c) 2011 TJ Holowaychuk
6- * MIT Licensed
7- */
8-
9-/**
10- * Module dependencies.
11- */
12-
13-var HTTPServer = require('./http').Server
14- , https = require('https');
15-
16-/**
17- * Initialize a new `Server` with the given
18- *`options` and `middleware`. The HTTPS api
19- * is identical to the [HTTP](http.html) server,
20- * however TLS `options` must be provided before
21- * passing in the optional middleware.
22- *
23- * @params {Object} options
24- * @params {Array} middleawre
25- * @return {Server}
26- * @api public
27- */
28-
29-var Server = exports.Server = function HTTPSServer(options, middleware) {
30- this.stack = [];
31- middleware.forEach(function(fn){
32- this.use(fn);
33- }, this);
34- https.Server.call(this, options, this.handle);
35-};
36-
37-/**
38- * Inherit from `http.Server.prototype`.
39- */
40-
41-Server.prototype.__proto__ = https.Server.prototype;
42-
43-// mixin HTTPServer methods
44-
45-Object.keys(HTTPServer.prototype).forEach(function(method){
46- Server.prototype[method] = HTTPServer.prototype[method];
47-});
node_modules/connect/lib/index.js+0−44
@@ -1,44 +0,0 @@
1-
2-/**
3- * # Connect
4- *
5- * Connect is a middleware framework for node,
6- * shipping with over 11 bundled middleware and a rich choice of
7- * [3rd-party middleware](https://github.com/senchalabs/connect/wiki).
8- *
9- * Installation:
10- *
11- * $ npm install connect
12- *
13- * API:
14- *
15- * - [connect](connect.html) general
16- * - [http](http.html) http server
17- * - [https](https.html) https server
18- *
19- * Middleware:
20- *
21- * - [logger](middleware-logger.html) request logger with custom format support
22- * - [basicAuth](middleware-basicAuth.html) basic http authentication
23- * - [bodyParser](middleware-bodyParser.html) extensible request body parser
24- * - [cookieParser](middleware-cookieParser.html) cookie parser
25- * - [session](middleware-session.html) session management support with bundled [MemoryStore](middleware-session-memory.html)
26- * - [compiler](middleware-compiler.html) static asset compiler (sass, less, coffee-script, etc)
27- * - [methodOverride](middleware-methodOverride.html) faux HTTP method support
28- * - [responseTime](middleware-responseTime.html) calculates response-time and exposes via X-Response-Time
29- * - [router](middleware-router.html) provides rich Sinatra / Express-like routing
30- * - [static](middleware-static.html) streaming static file server supporting `Range` and more
31- * - [directory](middleware-directory.html) directory listing middleware
32- * - [vhost](middleware-vhost.html) virtual host sub-domain mapping middleware
33- * - [favicon](middleware-favicon.html) efficient favicon server (with default icon)
34- * - [limit](middleware-limit.html) limit the bytesize of request bodies
35- * - [profiler](middleware-profiler.html) request profiler reporting response-time, memory usage, etc
36- * - [query](middleware-query.html) automatic querystring parser, populating `req.query`
37- * - [errorHandler](middleware-errorHandler.html) flexible error handler
38- *
39- * Internals:
40- *
41- * - connect [utilities](utils.html)
42- * - node monkey [patches](patch.html)
43- *
44- */
node_modules/connect/lib/middleware/basicAuth.js+0−93
@@ -1,93 +0,0 @@
1-
2-/*!
3- * Connect - basicAuth
4- * Copyright(c) 2010 Sencha Inc.
5- * Copyright(c) 2011 TJ Holowaychuk
6- * MIT Licensed
7- */
8-
9-/**
10- * Module dependencies.
11- */
12-
13-var utils = require('../utils')
14- , unauthorized = utils.unauthorized
15- , badRequest = utils.badRequest;
16-
17-/**
18- * Enfore basic authentication by providing a `callback(user, pass)`,
19- * which must return `true` in order to gain access. Alternatively an async
20- * method is provided as well, invoking `callback(user, pass, callback)`. Populates
21- * `req.remoteUser`. The final alternative is simply passing username / password
22- * strings.
23- *
24- * Examples:
25- *
26- * connect(connect.basicAuth('username', 'password'));
27- *
28- * connect(
29- * connect.basicAuth(function(user, pass){
30- * return 'tj' == user & 'wahoo' == pass;
31- * })
32- * );
33- *
34- * connect(
35- * connect.basicAuth(function(user, pass, fn){
36- * User.authenticate({ user: user, pass: pass }, fn);
37- * })
38- * );
39- *
40- * @param {Function|String} callback or username
41- * @param {String} realm
42- * @api public
43- */
44-
45-module.exports = function basicAuth(callback, realm) {
46- var username, password;
47-
48- // user / pass strings
49- if ('string' == typeof callback) {
50- username = callback;
51- password = realm;
52- if ('string' != typeof password) throw new Error('password argument required');
53- realm = arguments[2];
54- callback = function(user, pass){
55- return user == username && pass == password;
56- }
57- }
58-
59- realm = realm || 'Authorization Required';
60-
61- return function(req, res, next) {
62- var authorization = req.headers.authorization;
63-
64- if (req.remoteUser) return next();
65- if (!authorization) return unauthorized(res, realm);
66-
67- var parts = authorization.split(' ')
68- , scheme = parts[0]
69- , credentials = new Buffer(parts[1], 'base64').toString().split(':');
70-
71- if ('Basic' != scheme) return badRequest(res);
72-
73- // async
74- if (callback.length >= 3) {
75- var pause = utils.pause(req);
76- callback(credentials[0], credentials[1], function(err, user){
77- if (err || !user) return unauthorized(res, realm);
78- req.remoteUser = user;
79- next();
80- pause.resume();
81- });
82- // sync
83- } else {
84- if (callback(credentials[0], credentials[1])) {
85- req.remoteUser = credentials[0];
86- next();
87- } else {
88- unauthorized(res, realm);
89- }
90- }
91- }
92-};
93-
node_modules/connect/lib/middleware/bodyParser.js+0−92
@@ -1,92 +0,0 @@
1-
2-/*!
3- * Connect - bodyParser
4- * Copyright(c) 2010 Sencha Inc.
5- * Copyright(c) 2011 TJ Holowaychuk
6- * MIT Licensed
7- */
8-
9-/**
10- * Module dependencies.
11- */
12-
13-var qs = require('qs');
14-
15-/**
16- * Extract the mime type from the given request's
17- * _Content-Type_ header.
18- *
19- * @param {IncomingMessage} req
20- * @return {String}
21- * @api private
22- */
23-
24-function mime(req) {
25- var str = req.headers['content-type'] || '';
26- return str.split(';')[0];
27-}
28-
29-/**
30- * Parse request bodies.
31- *
32- * By default _application/json_ and _application/x-www-form-urlencoded_
33- * are supported, however you may map `connect.bodyParser.parse[contentType]`
34- * to a function of your choice to replace existing parsers, or implement
35- * one for other content-types.
36- *
37- * Examples:
38- *
39- * connect.createServer(
40- * connect.bodyParser()
41- * , function(req, res) {
42- * res.end('viewing user ' + req.body.user.name);
43- * }
44- * );
45- *
46- * Since both _json_ and _x-www-form-urlencoded_ are supported by
47- * default, either of the following requests would result in the response
48- * of "viewing user tj".
49- *
50- * $ curl -d 'user[name]=tj' http://localhost/
51- * $ curl -d '{"user":{"name":"tj"}}' -H "Content-Type: application/json" http://localhost/
52- *
53- * @return {Function}
54- * @api public
55- */
56-
57-exports = module.exports = function bodyParser(){
58- return function bodyParser(req, res, next) {
59- if ('GET' == req.method || 'HEAD' == req.method) return next();
60- var parser = exports.parse[mime(req)];
61- if (parser && !req.body) {
62- var data = '';
63- req.setEncoding('utf8');
64- req.on('data', function(chunk) { data += chunk; });
65- req.on('end', function(){
66- req.rawBody = data;
67- try {
68- req.body = data
69- ? parser(data)
70- : {};
71- } catch (err) {
72- return next(err);
73- }
74- next();
75- });
76- } else {
77- next();
78- }
79- }
80-};
81-
82-/**
83- * Supported decoders.
84- *
85- * - application/x-www-form-urlencoded
86- * - application/json
87- */
88-
89-exports.parse = {
90- 'application/x-www-form-urlencoded': qs.parse
91- , 'application/json': JSON.parse
92-};
node_modules/connect/lib/middleware/compiler.js+0−163
@@ -1,163 +0,0 @@
1-
2-/*!
3- * Connect - compiler
4- * Copyright(c) 2010 Sencha Inc.
5- * Copyright(c) 2011 TJ Holowaychuk
6- * MIT Licensed
7- */
8-
9-/**
10- * Module dependencies.
11- */
12-
13-var fs = require('fs')
14- , path = require('path')
15- , parse = require('url').parse;
16-
17-/**
18- * Require cache.
19- */
20-
21-var cache = {};
22-
23-/**
24- * Setup compiler.
25- *
26- * Options:
27- *
28- * - `src` Source directory, defaults to **CWD**.
29- * - `dest` Destination directory, defaults `src`.
30- * - `enable` Array of enabled compilers.
31- *
32- * Compilers:
33- *
34- * - `sass` Compiles cass to css
35- * - `less` Compiles less to css
36- * - `coffeescript` Compiles coffee to js
37- *
38- * @param {Object} options
39- * @api public
40- */
41-
42-exports = module.exports = function compiler(options){
43- options = options || {};
44-
45- var srcDir = options.src || process.cwd()
46- , destDir = options.dest || srcDir
47- , enable = options.enable;
48-
49- if (!enable || enable.length === 0) {
50- throw new Error('compiler\'s "enable" option is not set, nothing will be compiled.');
51- }
52-
53- return function compiler(req, res, next){
54- if ('GET' != req.method) return next();
55- var pathname = parse(req.url).pathname;
56- for (var i = 0, len = enable.length; i < len; ++i) {
57- var name = enable[i]
58- , compiler = compilers[name];
59- if (compiler.match.test(pathname)) {
60- var src = (srcDir + pathname).replace(compiler.match, compiler.ext)
61- , dest = destDir + pathname;
62-
63- // Compare mtimes
64- fs.stat(src, function(err, srcStats){
65- if (err) {
66- if ('ENOENT' == err.code) {
67- next();
68- } else {
69- next(err);
70- }
71- } else {
72- fs.stat(dest, function(err, destStats){
73- if (err) {
74- // Oh snap! it does not exist, compile it
75- if ('ENOENT' == err.code) {
76- compile();
77- } else {
78- next(err);
79- }
80- } else {
81- // Source has changed, compile it
82- if (srcStats.mtime > destStats.mtime) {
83- compile();
84- } else {
85- // Defer file serving
86- next();
87- }
88- }
89- });
90- }
91- });
92-
93- // Compile to the destination
94- function compile() {
95- fs.readFile(src, 'utf8', function(err, str){
96- if (err) {
97- next(err);
98- } else {
99- compiler.compile(str, function(err, str){
100- if (err) {
101- next(err);
102- } else {
103- fs.writeFile(dest, str, 'utf8', function(err){
104- next(err);
105- });
106- }
107- });
108- }
109- });
110- }
111- return;
112- }
113- }
114- next();
115- };
116-};
117-
118-/**
119- * Bundled compilers:
120- *
121- * - [sass](http://github.com/visionmedia/sass.js) to _css_
122- * - [less](http://github.com/cloudhead/less.js) to _css_
123- * - [coffee](http://github.com/jashkenas/coffee-script) to _js_
124- */
125-
126-var compilers = exports.compilers = {
127- sass: {
128- match: /\.css$/,
129- ext: '.sass',
130- compile: function(str, fn){
131- var sass = cache.sass || (cache.sass = require('sass'));
132- try {
133- fn(null, sass.render(str));
134- } catch (err) {
135- fn(err);
136- }
137- }
138- },
139- less: {
140- match: /\.css$/,
141- ext: '.less',
142- compile: function(str, fn){
143- var less = cache.less || (cache.less = require('less'));
144- try {
145- less.render(str, fn);
146- } catch (err) {
147- fn(err);
148- }
149- }
150- },
151- coffeescript: {
152- match: /\.js$/,
153- ext: '.coffee',
154- compile: function(str, fn){
155- var coffee = cache.coffee || (cache.coffee = require('coffee-script'));
156- try {
157- fn(null, coffee.compile(str));
158- } catch (err) {
159- fn(err);
160- }
161- }
162- }
163-};
node_modules/connect/lib/middleware/cookieParser.js+0−46
@@ -1,46 +0,0 @@
1-
2-/*!
3- * Connect - cookieParser
4- * Copyright(c) 2010 Sencha Inc.
5- * Copyright(c) 2011 TJ Holowaychuk
6- * MIT Licensed
7- */
8-
9-/**
10- * Module dependencies.
11- */
12-
13-var utils = require('./../utils');
14-
15-/**
16- * Parse _Cookie_ header and populate `req.cookies`
17- * with an object keyed by the cookie names.
18- *
19- * Examples:
20- *
21- * connect.createServer(
22- * connect.cookieParser()
23- * , function(req, res, next){
24- * res.end(JSON.stringify(req.cookies));
25- * }
26- * );
27- *
28- * @return {Function}
29- * @api public
30- */
31-
32-module.exports = function cookieParser(){
33- return function cookieParser(req, res, next) {
34- var cookie = req.headers.cookie;
35- if (req.cookies) return next();
36- req.cookies = {};
37- if (cookie) {
38- try {
39- req.cookies = utils.parseCookie(cookie);
40- } catch (err) {
41- return next(err);
42- }
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/lib/middleware/directory.js+0−218
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/lib/middleware/errorHandler.js+0−100
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/lib/middleware/favicon.js+0−76
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/lib/middleware/limit.js+0−78
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/lib/middleware/logger.js+0−283
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/lib/middleware/methodOverride.js+0−38
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/lib/middleware/profiler.js+0−100
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/lib/middleware/query.js+0−40
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/lib/middleware/responseTime.js+0−34
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/lib/middleware/router.js+0−379
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/lib/middleware/session.js+0−346
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/lib/middleware/session/cookie.js+0−126
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/lib/middleware/session/memory.js+0−131
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/lib/middleware/session/session.js+0−137
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/lib/middleware/session/store.js+0−59
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/lib/middleware/static.js+0−212
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/lib/middleware/vhost.js+0−44
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/lib/patch.js+0−51
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/lib/public/directory.html+0−75
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/lib/public/error.html+0−13
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/lib/public/favicon.ico+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_add.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_attach.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_code.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_copy.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_delete.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_edit.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_error.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_excel.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_find.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_gear.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_go.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_green.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_key.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_lightning.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_link.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_paintbrush.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_paste.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_red.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_refresh.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_save.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_acrobat.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_actionscript.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_add.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_c.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_camera.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_cd.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_code.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_code_red.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_coldfusion.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_compressed.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_copy.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_cplusplus.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_csharp.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_cup.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_database.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_delete.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_dvd.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_edit.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_error.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_excel.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_find.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_flash.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_freehand.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_gear.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_get.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_go.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_h.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_horizontal.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_key.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_lightning.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_link.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_magnify.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_medal.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_office.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_paint.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_paintbrush.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_paste.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_php.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_picture.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_powerpoint.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_put.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_ruby.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_stack.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_star.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_swoosh.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_text.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_text_width.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_tux.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_vector.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_visualstudio.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_width.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_word.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_world.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_wrench.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_white_zip.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_word.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/icons/page_world.png+0−0
Binary file, not shown.
node_modules/connect/lib/public/style.css+0−141
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/lib/utils.js+0−427
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/meta.json+0−1
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/mime/LICENSE+0−19
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/mime/README.md+0−54
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/mime/index.js+0−1
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/mime/mime.js+0−89
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/mime/mime.types+0−1479
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/mime/node.types+0−7
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/mime/package.json+0−11
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/mime/test.js+0−74
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/.gitmodules+0−6
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/History.md+0−41
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/Makefile+0−7
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/Readme.md+0−49
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/benchmark.js+0−32
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/examples.js+0−39
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/index.js+0−2
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/lib/querystring.js+0−203
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/package.json+0−9
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/support/expresso/.gitignore+0−3
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/support/expresso/.gitmodules+0−3
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/support/expresso/History.md+0−128
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/support/expresso/Makefile+0−53
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/support/expresso/Readme.md+0−61
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/support/expresso/bin/expresso+0−856
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/support/expresso/docs/api.html+0−1080
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/support/expresso/docs/index.html+0−377
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/support/expresso/docs/index.md+0−290
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/support/expresso/docs/layout/foot.html+0−3
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/support/expresso/docs/layout/head.html+0−42
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/support/expresso/lib/bar.js+0−4
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/support/expresso/lib/foo.js+0−16
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/support/expresso/package.json+0−12
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/support/expresso/test/assert.test.js+0−91
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/support/expresso/test/async.test.js+0−12
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/support/expresso/test/bar.test.js+0−13
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/support/expresso/test/foo.test.js+0−14
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/support/expresso/test/http.test.js+0−146
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/support/expresso/test/serial/async.test.js+0−39
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/support/expresso/test/serial/http.test.js+0−48
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/support/should/.gitmodules+0−3
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/support/should/History.md+0−22
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/support/should/Makefile+0−6
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/support/should/Readme.md+0−248
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/support/should/examples/runner.js+0−53
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/support/should/index.js+0−2
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/support/should/lib/eql.js+0−91
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/support/should/lib/should.js+0−548
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/support/should/package.json+0−8
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/support/should/test/should.test.js+0−358
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/test/parse.test.js+0−133
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/node_modules/qs/test/stringify.test.js+0−95
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/package.json+0−24
Cut short: this commit's diff is over 1000 lines.
node_modules/connect/test.js+0−19
Cut short: this commit's diff is over 1000 lines.
node_modules/request/LICENSE+0−55
Cut short: this commit's diff is over 1000 lines.
node_modules/request/README.md+0−123
Cut short: this commit's diff is over 1000 lines.
node_modules/request/cookies.js+0−150
Cut short: this commit's diff is over 1000 lines.
node_modules/request/main.js+0−423
Cut short: this commit's diff is over 1000 lines.
node_modules/request/mimetypes.js+0−146
Cut short: this commit's diff is over 1000 lines.
node_modules/request/package.json+0−14
Cut short: this commit's diff is over 1000 lines.
node_modules/request/tests/googledoodle.png+0−0
Binary file, not shown.
node_modules/request/tests/server.js+0−45
Cut short: this commit's diff is over 1000 lines.
node_modules/request/tests/test-body.js+0−74
Cut short: this commit's diff is over 1000 lines.
node_modules/request/tests/test-cookies.js+0−0
node_modules/request/tests/test-errors.js+0−30
Cut short: this commit's diff is over 1000 lines.
node_modules/request/tests/test-pipes.js+0−136
Cut short: this commit's diff is over 1000 lines.
node_modules/request/tests/test-ssl.js+0−7
Cut short: this commit's diff is over 1000 lines.
node_modules/request/tests/test-timeout.js+0−84
Cut short: this commit's diff is over 1000 lines.
server.js+29−33
Cut short: this commit's diff is over 1000 lines.