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 item = { "hdbarcode": hdbarcode, "description": description }; | |
| // 2nd argument is callback | |
| getDescription(item.hdbarcode, function(upcDescrip){ | |
| db.save(null, item, function (err, meta) { | |
| // This does not change item on line 1. Why? | |
| item.key = meta.key; | |
| sys.puts('saved ' + JSON.stringify(item) + ' as '+ meta.key); | |
| // tell client |
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 noc = require('noc'); | |
| var job = noc.createJob('install node.js on ubuntu'); | |
| job.addTask(function (server) { | |
| // Some javascript code .. maybe: | |
| // server.mkdir(....) | |
| }); | |
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
| #!/usr/bin/env ruby | |
| # script/whitespace | |
| # | |
| # Strips whitespace from any files modified in git | |
| # Also: | |
| # - converts tabs to spaces | |
| # - ensures a single newline at the end | |
| class WhitespaceProcessor | |
| def self.process(code) |
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 givens = {}; | |
| var Given = function (pattern, topicGenerator) { | |
| givens[pattern] = topicGenerator; | |
| }; | |
| var whens = {}; | |
| var When = function (pattern, topicGenerator) { | |
| whens[pattern] = topicGenerator; | |
| }; |
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 givens = {}; | |
| var Given = function (pattern, topicGenerator) { | |
| givens[pattern] = topicGenerator; | |
| }; | |
| var whens = {}; | |
| var When = function (pattern, topicGenerator) { | |
| whens[pattern] = topicGenerator; | |
| }; |
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 http = require('http'), | |
| sys = require('sys'); | |
| exports.createServer = function createServer (port, host) { | |
| return new HttpProxy({ | |
| port: +port, | |
| host: host || '0.0.0.0' | |
| }); | |
| }; |
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 proxy = require('./http-proxy'), | |
| http = require('http'); | |
| http.createServer(function (req, res){ | |
| res.writeHead(200, {'Content-Type': 'text/plain'}); | |
| res.write('request successfully proxied to: ' + req.url + '\n' + JSON.stringify(req.headers, true, 2)); | |
| res.end(); | |
| }).listen(9000); | |
| proxy.createServer(9000, 'localhost').listen(8000); |
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.setProxy = function(server,port) { | |
| _port = parseInt( port ); | |
| _server = server; | |
| proxy = httpProxy.HttpProxy; | |
| } | |
| exports.handler = function( request, response, next ) { | |
| proxy.watch(request,response); | |
| if( request.profile || request.session.profile ) { |
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
| // This is how I would love to use it from Javascript... | |
| var gherkin = require('gherkin'); | |
| var simpleListener = { | |
| feature: function(keyword, name, description, line) {}; | |
| scenario: function(keyword, name, description, line) {}; | |
| step: function(keyword, name, line) {}; | |
| }; |
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 httpAgent = require('http-agent'), | |
| url = require('url'), | |
| sys = require('sys'); | |
| exports.start = function () { | |
| var agent = httpAgent.create('www.bungie.net', ['/stats/reach/playergamehistory.aspx?player=thechapel&vc=2']); | |
| agent.addListener('next', function (err, agent) { | |
| var uri = url.parse(agent.current.uri); | |
| exports.dispatch(uri); |