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
module.exports = function(app){ | |
var res = app.response; | |
res.flash = function(type, msg) { | |
res.cookie("floored-flash", "test"); | |
} | |
res.flash.error = function(msg) { | |
res.flash("error", msg); | |
} |
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 kue = require('./kue'); | |
var jobs = kue.createQueue(); | |
var autoscale = require('./autoscale')(jobs); | |
exports.create = function(type, options, callback) { | |
// Make 'options' parameter optional | |
if (typeof options === "function") { | |
callback = options; | |
options = null; | |
} |
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
grunt.registerTask('deploy:staging', function() { | |
var child = grunt.util.spawn({ | |
cmd: 'ls', | |
args: ['-a'] | |
}, function(err, result) { | |
console.log(err); | |
console.log(result); | |
}); | |
}); |
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 util = require('util'); | |
var _ = require('underscore'); | |
httpError('NotFound', 'Not Found', 404); | |
httpError('Server', 'There was an error', 500); | |
httpError('Unauthorized', 'You must log in to access this', 401); | |
httpError('Forbidden', 'You do not have permission to access this', 403); | |
httpError('BadRequest', 'There was an error with your input', 400); | |
function httpError(name, default_msg, status_code) { |
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 _ = require('underscore'); | |
var obj = { | |
one_level_string: "1", | |
one_level_array: ["hey", "there"], | |
two_levels: { | |
a: "a", | |
b: "b", | |
c: ["ccc", "ddd"], | |
d: { |
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 Dissolve = require("dissolve"); | |
var parser = Dissolve().loop(function(end) { | |
this.uint8("numHouses") | |
.tap(function() { | |
this.housesCount = 0; | |
}) | |
.loop("houses", function(end) { |