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
tcp = require("tcp"); | |
sys = require("sys"); | |
// Google smtp server | |
var client = tcp.createConnection(25, 'smtp.gmail.com'); | |
// Thawte Premium Server CA | |
var caPem = '-----BEGIN CERTIFICATE-----\n' | |
+ 'MIIDJzCCApCgAwIBAgIBATANBgkqhkiG9w0BAQQFADCBzjELMAkGA1UEBhMCWkEx\n' | |
+ 'FTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYD\n' |
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
//http://blog.nodejitsu.com/jsdom-jquery-in-5-lines-on-nodejs | |
var httpAgent = require('http-agent'), | |
jsdom = require('jsdom'), | |
sys = require('sys'); | |
var agent = httpAgent.create('www.google.com', ['finance', 'news', 'images']); | |
//original line: | |
//agent.addListener('next', function (agent) { |
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 sys = require('sys'), | |
eyes = require('eyes'), | |
url = require('url'), | |
querystring = require('querystring'), | |
httpProxy = require('http-proxy'); | |
exports.start = function() { | |
var static = require('node-static'); | |
// Create a node-static server to serve the current directory | |
var file = new(static.Server)('./public', { cache: 7200, headers: {'X-Hello':'World!'} }); |
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); |
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
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
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
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 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; | |
}; |