Skip to content

Instantly share code, notes, and snippets.

@ry
ry / https-hello-world.js
Created January 4, 2011 00:03
new node https api
// curl -k https://localhost:8000/
var https = require('https');
var fs = require('fs');
var options = {
key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')
};
https.createServer(options, function (req, res) {
@jonastemplestein
jonastemplestein / node-callAsync.js
Created August 10, 2010 23:25
Nifty function that generates a callback that cannot be executed synchronously
/**
* Nifty function that generates a callback that cannot be executed synchronously
* This is useful to circumvent the behaviour of crappy libraries that are not always async
* (e.g. if they cache certain results)
*/
exports.callAsync = function(original_callback) {
// capture scope
var self = this;
return function() {
var args = arguments;