This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task('foo', {async: true}, function () { | |
console.log('entered foo'); | |
setTimeout(complete, 10); | |
console.log('after foo timeout'); | |
}); | |
task('default', {async: true}, function () { | |
var t = jake.Task.foo; | |
t.on('complete', function () { | |
console.log('foo completed'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http') | |
, domain = require('domain') | |
, mongo = require('mongodb') | |
, config = { | |
username: null | |
, dbname: null | |
, prefix: null | |
, password: null | |
, host: 'localhost' | |
, port: 27017 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http') | |
, server = http.createServer(); | |
server.on('request', function (serverReq, | |
serverResp) { | |
var host = 'www.example.com' | |
, opts | |
, clientRequest | |
, handle; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream foo_site { | |
server 127.0.0.1:4000; | |
} | |
server { | |
listen 80; | |
server_name www.foo.com foo.com; | |
access_log /var/log/nginx/foo_site.access.log; | |
location / { | |
proxy_pass http://foo_site; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var escapeEscapeSequences = function (str) { | |
return str | |
.replace(/[\\]/g, '\\\\') // Slash has to go first | |
.replace(/[\b]/g, '\\b') | |
.replace(/[\f]/g, '\\f') | |
.replace(/[\n]/g, '\\n') | |
.replace(/[\r]/g, '\\r') | |
.replace(/[\t]/g, '\\t'); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bash-3.2$ npm install | |
npm http GET https://registry.npmjs.org/filelist | |
npm http GET https://registry.npmjs.org/minimatch/0.2.3 | |
npm http 200 https://registry.npmjs.org/filelist | |
npm http GET https://registry.npmjs.org/filelist/-/filelist-0.0.2.tgz | |
npm http 200 https://registry.npmjs.org/minimatch/0.2.3 | |
npm http GET https://registry.npmjs.org/minimatch/-/minimatch-0.2.3.tgz | |
npm http 200 https://registry.npmjs.org/filelist/-/filelist-0.0.2.tgz | |
npm WARN package.json filelist@0.0.2 No README.md file found! | |
npm http 200 https://registry.npmjs.org/minimatch/-/minimatch-0.2.3.tgz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http') | |
, domain = require('domain') | |
, riakpbc = require('./index') | |
, riak = riakpbc.createClient({host: 'localhost', port: 8087}); | |
http.createServer(function (req, res) { | |
var dmn = domain.create(); | |
dmn.on('error', function (err) { | |
console.dir(arguments); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> var foo = function (a) { return function (b) { return a * b; }; }; | |
undefined | |
> var bar = foo(2); | |
undefined | |
> bar(5); | |
10 | |
> var foo = function () { console.log(arguments.length); }; | |
undefined | |
> foo(); | |
0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mixin = function () { | |
var args = Array.prototype.slice.call(arguments); | |
var target = args.shift(); | |
var source = args.shift(); | |
// We don't need no hasOwnProperty checks! | |
for (var prop in source) { | |
target[prop] = source[prop]; | |
} | |
if (args.length) { | |
args.unshift(target); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var foo = function (seed) { | |
var currVal = seed; | |
var incrementor = function () { | |
currVal++; | |
console.log(currVal); | |
}; | |
return incrementor; | |
}; |
OlderNewer