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 () { | |
// exports will be set in any commonjs platform. | |
// because the anonymous function is being called without | |
// a scope being set, "this" will refer to the global scope. | |
// In a browser, that's the window. In other JS platforms, | |
// it may be some other thing. | |
var out = typeof exports !== "undefined" ? exports : this; | |
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"); | |
function someFunc () { | |
throw "thrown from someFunc" | |
}; | |
function h1 (m) { | |
sys.debug("caught in h1: "+m); | |
} | |
function h2 (m) { |
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 Promise = require("events").Promise, | |
sys = require("sys"); | |
Promise.prototype.test = function (fn) { | |
return this.addCallback(fn); | |
}; | |
function foo () { | |
var p = new Promise(); |
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
// these are all the same. | |
require("http").createServer(function (req,res) { | |
res.sendHeader(200, { | |
"set-cookie" : [ "foo=bar", "bar=baz" ], | |
"x" : ["y", "z"], | |
"y" : ["a", "b"] | |
}); | |
res.finish(); | |
}).listen(8000, "localhost"); |
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 node-bench | |
var list = [ | |
"foo", | |
"bar", | |
"baz", | |
"quux", | |
"asdf", | |
"qwerty", |
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
diff --git a/deps/v8/tools/linux-tick-processor b/deps/v8/tools/linux-tick-processor | |
old mode 100644 | |
new mode 100755 | |
diff --git a/lib/http.js b/lib/http.js | |
index dcb152e..2bcfe1b 100644 | |
--- a/lib/http.js | |
+++ b/lib/http.js | |
@@ -88,9 +88,8 @@ IncomingMessage.prototype.resume = function () { | |
IncomingMessage.prototype._addHeaderLine = function (field, value) { |
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
diff --git a/lib/multipart.js b/lib/multipart.js | |
index a5afeff..4114569 100644 | |
--- a/lib/multipart.js | |
+++ b/lib/multipart.js | |
@@ -51,7 +51,8 @@ proto.init = function(options) { | |
this.part = null; | |
if ('headers' in options) { | |
- var req = options, contentType = req.headers['content-type']; | |
+ var req = options, |
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
// EXAMPLE 1: async response | |
// PSGI equivalent | |
var app = function(env) { | |
return function(respond) { | |
// do some event stuff | |
setTimeout(function() { | |
respond({ status : code, headers : headers, body : body }); | |
}, 1000); | |
} |
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 defined out here. | |
exports.foo = "bar" | |
require( | |
"sys", "file", "persistence/sqlite3" | |
)(function (sys, file, sqlite) { | |
sys.p(File); | |
// Rest of program here | |
}); |