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 net = require("net"); | |
var crypto = require("crypto"); | |
var fs = require("fs"); | |
var multi = null; | |
var _states = { | |
"open": "open", | |
"closed": "closed", | |
"readOnly": "readOnly", | |
"writeOnly": "writeOnly", |
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 vm = require('vm'), | |
code = 'var square = n * n;', | |
fn = new Function('n', code), | |
script = vm.createScript(code), | |
sandbox; | |
n = 5; | |
sandbox = { n: n }; | |
benchmark = function(title, funk) { |
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 test1() { | |
function test(j) { | |
var s = 0; | |
for (var i = 0; i < j; i++) s = i; | |
for (var i = 0; i < j; i++) s = i; | |
for (var i = 0; i < j; i++) s = i; | |
for (var i = 0; i < j; i++) s = i; | |
return s; | |
} | |
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
From 5f933b1df831f94f9003375a6ed578896506c3e4 Mon Sep 17 00:00:00 2001 | |
From: Andrew Johnston <[email protected]> | |
Date: Mon, 21 Mar 2011 21:50:15 +0000 | |
Subject: [PATCH] added option for tcp or unix_dgram syslogging | |
--- | |
index.js | 469 ++++++++++++++++++++++++++++++++------------------------------ | |
1 files changed, 243 insertions(+), 226 deletions(-) | |
diff --git a/index.js b/index.js |
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 net = require("net"); | |
var fastcgi = require("fastcgi"); | |
var reqid = 0; | |
var post = "fname=aaa&lname=fff"; | |
var params = [ | |
["REQUEST_METHOD", "POST"], | |
["SCRIPT_FILENAME", process.ARGV[2]], | |
["CONTENT_TYPE", "application/x-www-form-urlencoded"], |
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"); | |
/* | |
add following to your hosts config to test: | |
10.11.12.8 www.vhost1.net | |
10.11.12.8 www.vhost2.com | |
10.11.12.8 www.vhost3.test.com | |
10.11.12.8 static.vhost1.net |
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 mysql = require("mysql/client"); | |
var http = require("http"); | |
var client = mysql({ | |
"host": "127.0.0.1", | |
"port": 3306, | |
"user": "root", | |
"password": "password" | |
}); |
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
/* | |
generate your key and cert as follows: | |
openssl genrsa -out server.key.pem 1024 | |
openssl req -new -key server.key.pem -out server.csr.pem | |
openssl x509 -req -in server.csr.pem -signkey server.key.pem -out server.cert.pem | |
*/ | |
var http = require("https"); | |
var fs = require("fs"); |
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 just a standard node.js module | |
exports.foo = function() { | |
return ("hello from " + process.ARGV[2]); | |
} |
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 fs = require("fs"); | |
var constants = process.binding("constants"); | |
exports.f2s = function(file, socket, off, len, cb, chunked) { | |
var twrite = 0; | |
var chunksize = len < 4096?len:4096; | |
function chunk() { | |
try { | |
if(chunked) { | |
if(off + chunksize > len) chunksize = len - off; |