This file contains 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'), | |
crypto = require('crypto'), | |
algos = ["sha1", "md5", "sha256", "sha512", "ripemd160"], | |
encoding = "hex"; | |
algos.forEach( function( algo) { | |
exports[ algo ] = function(data, salt) { | |
return (typeof salt === 'undefined') | |
? crypto.createHash(algo).update(data).digest(encoding) | |
: crypto.createHmac(algo, salt).update(data).digest(encoding) |
This file contains 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 crypto = require('crypto'); | |
["sha1", "md5", "sha256", "sha512", "ripemd160"].forEach(function(algo) { | |
exports[algo] = function(data, salt) { | |
return crypto["createH"+(typeof salt != 'undefined' ? "mac":"ash"](algo,salt) | |
.update(data).digest("hex"); | |
}; | |
}); |
This file contains 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 HTTPParser = process.binding('http_parser').HTTPParser; | |
var net = require('net'); | |
var path = require('path'); | |
var sys = require('sys'); | |
var Worker = require('webworker').Worker; | |
var VHOSTS = ['foo.bar.com', 'baz.bizzle.com']; | |
var WORKERS = {}; | |
VHOSTS.forEach(function(vh) { |
This file contains 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
fromAll("foo","bar","baz","widget", function(foo, bar, baz, widget){ | |
var myThing | |
// Actual library code | |
return myThing | |
}) |
This file contains 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/module.js b/lib/module.js | |
index 72814a7..0827d13 100644 | |
--- a/lib/module.js | |
+++ b/lib/module.js | |
@@ -83,17 +83,6 @@ var pathFn = process.compile("(function (exports) {" + natives.path + "\n})", | |
var pathModule = createInternalModule('path', pathFn); | |
var path = pathModule.exports; | |
-function existsSync (path) { | |
- try { |
This file contains 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/module.js b/lib/module.js | |
index 72814a7..1db1cb4 100644 | |
--- a/lib/module.js | |
+++ b/lib/module.js | |
@@ -83,17 +83,6 @@ var pathFn = process.compile("(function (exports) {" + natives.path + "\n})", | |
var pathModule = createInternalModule('path', pathFn); | |
var path = pathModule.exports; | |
-function existsSync (path) { | |
- try { |
This file contains 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/stream.js b/lib/stream.js | |
index 189708a..37687b0 100644 | |
--- a/lib/stream.js | |
+++ b/lib/stream.js | |
@@ -53,3 +53,22 @@ Stream.prototype.pipe = function (dest, options) { | |
if (source.readable) source.resume(); | |
}); | |
}; | |
+ | |
+exports.createFilter = function (listener) { |
This file contains 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
module.exports = Foo; | |
//now i would like to have a constructor function for the foo "class" (i know in JS that does not exist) | |
//with normal js this would be | |
function Foo(arg1,arg2){ | |
this.something = arg1; | |
this.somethingOther = arg2; | |
} |
This file contains 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
isaacs@cometrocket:~ | |
$ pbpaste > file.js | |
isaacs@cometrocket:~ | |
$ chmod 0755 file.js | |
isaacs@cometrocket:~ | |
$ ./file.js | |
testing |
This file contains 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
Copyright (c) 2011 YOUR_NAME_HERE, YOUR_URL_HERE | |
Permission is hereby granted, free of charge, to any person obtaining | |
a copy of this software and associated documentation files (the | |
"Software"), to deal in the Software without restriction, including | |
without limitation the rights to use, copy, modify, merge, publish, | |
distribute, sublicense, and/or sell copies of the Software, and to | |
permit persons to whom the Software is furnished to do so, subject to | |
the following conditions: | |