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 test(arg){ | |
| return arg + arg; | |
| } | |
| function testDecorator(fn, args){ | |
| var arg = args[0] * 2; | |
| return fn(arg); | |
| } |
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
| /** | |
| * Creates a recursive function from one that isn't | |
| * @param {Function} x A non-recursing function | |
| * @return {Function} A recursive version of x | |
| */ | |
| function yCombinator(x) { | |
| return (function(procedure) { | |
| return x(function(arg) { | |
| return procedure(procedure)(arg); | |
| }); |
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
| /** | |
| * Wraps a `Function` with another `Function`. This allows | |
| * the wrapper function to intercept and manipulate the | |
| * return value of the orginal function. | |
| * @param {Function} fn The function to wrap | |
| * @param {Function} wrapper The wrapper function | |
| * @return {Function} Return the wrapped function | |
| */ | |
| function wrap(fn, wrapper) { | |
| return function() { |
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
| <script type="text/javascript"> | |
| /* | |
| Example cars.csv: | |
| Year,Make,Model,Length | |
| 1997,Ford,E350,2.34 | |
| 2000,Mercury,Cougar,2.38 | |
| */ |
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
| app.configure(function(){ | |
| app.use(express.static(__dirname + '/public')); | |
| app.use(express.logger()); | |
| app.set('views', __dirname + '/views'); | |
| app.set('view engine', 'ejs'); | |
| // app.use(express.basicAuth( function( user, pass ) { | |
| // return 'COE' == user && 'b0gu5' == pass; | |
| // })); | |
| app.use(express.bodyParser()); | |
| app.use(express.methodOverride()); |
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
| exports = module.exports = function static(root, options){ | |
| options = options || {}; | |
| // root required | |
| if (!root) throw new Error('static() root path required'); | |
| options.root = root; | |
| return function static(req, res, next) { | |
| console.log('!!! STATIC HIT !!!'); | |
| console.log(req.path); |
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
| app.resource("data/post", PostResource); | |
| app.resource("data/author", AuthorResource); | |
| app.resource("data/media", MediaResource); | |
| // additional post routes | |
| app.delete('/data/post', PostResource.destroy_all); | |
| app.delete ('/data/author', AuthorResource.destroy_all); | |
| app.delete ('/data/media', MediaResource.destroy_all); |
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
| httpProxy.createServer(function(req,res,proxy) { | |
| if (req.url.match(/\/data/)) { | |
| console.log('data'); | |
| proxy.proxyRequest(req, res, { | |
| host: config.DATA_APP_HOST, | |
| port: config.DATA_APP_PORT | |
| }); | |
| } else if (req.url.match(/\/wordpress/)) { | |
| console.log('wordpress'); | |
| proxy.proxyRequest(req, res, { |
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
Show hidden characters
| [ | |
| { | |
| "args": | |
| { | |
| "to": "eol" | |
| }, | |
| "command": "move_to" | |
| }, | |
| { | |
| "args": |
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
| { "keys": ["super+;"], "command": "run_macro_file", "args": { "file": "Packages/User/insert-semicolon.sublime-macro" } }, |