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
'use strict'; | |
/** | |
* In order for this to work correctly, `this.path = path;` needs to be added in | |
* the Layer constructor function here: | |
* https://github.com/visionmedia/express/blob/7df7f7a575df4cf26c1d43535a6a1a6b8778933c/lib/router/layer.js#L21 | |
*/ | |
module.exports = function crawl(obj, path, tree) { | |
path = path || ''; |
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
'use strict'; | |
var http = require('http'); | |
var Rx = require('rx'); | |
var qs = require('qs'); | |
var server, source, subscription; | |
server = http.createServer(); |
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
import nil from 'optionil' | |
let obj = { | |
str: 'literal', | |
obj: { | |
num: 5 | |
} | |
}; | |
obj = nil(obj); |
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
Per https://code.google.com/p/v8/codesearch#v8/trunk/src/runtime.cc | |
%CreateSymbol | |
%CreatePrivateSymbol | |
%CreateGlobalPrivateSymbol | |
%NewSymbolWrapper | |
%SymbolDescription | |
%SymbolRegistry | |
%SymbolIsPrivate |
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
'use strict'; | |
var assert = require('assert'); | |
var path2regex = require('path-to-regexp'); | |
function reverse(route, obj) { | |
var keys; | |
keys = []; |
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
'use strict'; | |
module.exports = function (router) { | |
// Register function under slugified function name: `my-foo-route` | |
// Similar to `named.js`, the more I think about it not sure how this would work. | |
router.get('/foo', function myFooRoute(req, res) { | |
res.send('ok'); | |
}); | |
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
; CouchDB Config | |
; Drop in PREFIX/local.d/npmjs.ini | |
[couch_httpd_auth] | |
public_fields = appdotnet, avatar, avatarMedium, avatarLarge, date, email, fields, freenode, fullname, github, homepage, name, roles, twitter, type, _id, _rev | |
users_db_public = true | |
[httpd] | |
secure_rewrites = false |
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 vm = require('vm'); | |
var env, script; | |
env = { dust: { helpers: {} } }; | |
script = vm.createScript(fs.readFileSync(require.resolve('dustjs-helpers'), { encoding: 'utf8' })); | |
script.runInNewContext(env); | |
env.dust.helpers // [object Object] with all the helpers. |
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
function getFresh(name) { | |
var orig, fresh; | |
orig = snapshot(name); | |
invalidate(name); | |
fresh = require(name); | |
invalidate(name); | |
restore(orig); |
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
#!/usr/bin/env node | |
var chunks = []; | |
process.stdin.on('data', chunks.push.bind(chunks)); | |
process.stdin.on('end', function () { | |
var json; | |
json = Buffer.concat(chunks).toString('utf8'); | |
json = JSON.parse(json); | |
json = JSON.stringify(json, null, 2); | |
process.stdout.write(json); |