- Header
- Brief description (should match package.json)
- Example (if applicable)
- Motivation (if applicable)
- API Documentation: This will likely vary considerably from library to library.
- Installation
This file contains hidden or 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(window, undefined) { | |
var dloc = document.location; | |
function regifyString(str) { | |
if(~str.indexOf('*')) { | |
str = str.replace(/\*/g, '([_\.\(\)!\\ %@&a-zA-Z0-9-]+)'); | |
} | |
if(~str.indexOf(':')) { | |
str = str.replace(/:.*?\/|:.*?$/g, '([a-zA-Z0-9-]+)/'); |
This file contains hidden or 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 fs = require('fs'), | |
path = require('path'), | |
journey = require('journey'); | |
exports.loadAllRoutes = function () { | |
var router = new (journey.Router)({ | |
strict: false, | |
strictUrls: false, | |
api: 'basic' |
This file contains hidden or 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
{ | |
"passfail": false, | |
"maxerr": 100, | |
"browser": true, | |
"node": true, | |
"rhino": false, | |
"couch": true, | |
"wsh": true, | |
"jquery": true, |
This file contains hidden or 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 fs = require('fs'), | |
path = require('path'), | |
colors = require('colors'), | |
argv = require('optimist').argv; | |
fs.readFile(path.join(__dirname, argv._[0]), function (err, data) { | |
var lines = data.toString().split('\n'); | |
for (var i = 0; i < lines.length; i++) { |
This file contains hidden or 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
process.on('uncaughtException', function (err) { | |
throw err; | |
}); | |
process.on('uncaughtException', function (err) { | |
// | |
// This console.dir is never hit. | |
// | |
console.dir(err); | |
process.exit(1); |
This file contains hidden or 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 forever = require('forever'), | |
request = require('request'); | |
function checkIsHung (monitor) { | |
// | |
// Do something to check if your process is hung | |
// e.g. Make an http request | |
// | |
request({ uri: 'http://yourapp.com' }, function (err, res, body) { | |
if (err) { |
This file contains hidden or 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
with application | |
set env to production | |
set view engine to jade | |
get /user/tj | |
send "hello" | |
delete /user/tj | |
send "no can do!" |
This file contains hidden or 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
// Here is a proposal for minimalist JavaScript classes, humbly offered. | |
// There are (at least) two different directions in which classes can be steered. | |
// If we go for a wholly new semantics and implementation, then fancier classical | |
// inheritance can be supported with parallel prototype chains for true inheritance | |
// of properties at both the class and instance level. | |
// If however, we keep current JavaScript prototype semantics, and add a form that | |
// can desugar to ES3, things must necessarily stay simpler. This is the direction | |
// I'm assuming here. |
This file contains hidden or 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 cursor = dbclient.collection('example', _).find(_); | |
var count = cursor.count(_); | |
for(var obj = cursor.nextObject(_), oi = 0; obj; obj = | |
cursor.nextObject(_), oi++) { | |
/** | |
* do something with every obj here | |
* suppose for this example it needs total count and offset (oi). | |
*/ | |
}); |