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
Inimino’s way: | |
foo = routine { | |
if argument == 1, return ‘a’ | |
if argument == 2, return ‘b’ | |
if argument == 3, return ‘c’ | |
} | |
foo' = routine { | |
if argument == 2, return 'Changed' | |
else return foo(argument) |
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
/* | |
userData = { | |
'person1' : [1,2,3,4], | |
'person2' : [3,4,5,6] | |
} | |
*/ | |
First loop over all the userData once and construct an index. | |
index=[] |
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
testing with curl: | |
inimino@kat:~$ curl -sv -m3 http://boshi.inimino.org:8080/ >/dev/null | |
* About to connect() to boshi.inimino.org port 8080 (#0) | |
* Trying 69.164.198.129... connected | |
* Connected to boshi.inimino.org (69.164.198.129) port 8080 (#0) | |
> GET / HTTP/1.1 | |
> User-Agent: curl/7.19.7 (i486-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8m zlib/1.2.3.4 libidn/1.18 libssh2/1.2.1 | |
> Host: boshi.inimino.org:8080 | |
> Accept: */* |
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
# bash one-liner to run it and watch memory usage | |
( ./node test.js & PID=$! && trap 'kill $PID' 0; while sleep 1; do ps -o rss= -p $PID; done ) |
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 File = require('file'), | |
Sys = require('sys'), | |
Posix = require('posix'); | |
// Sync api wrapper around some Posix commands | |
// Sells it soul to `wait`. | |
var posix_sync = { | |
readdir: function (path) { | |
return Posix.readdir(path).wait(); | |
}, |
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 http = require('http'), | |
sys = require('sys'), | |
path = require('path'), | |
posix = require('posix'), | |
events = require('events'); | |
var listdir = function (pathname) { | |
var p = new events.Promise(); | |
var ls = process.createChildProcess("ls", [pathname]); | |
ls.addListener("output", function (data) { |
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 email = { | |
send:function (options){ | |
options = options||{}; | |
options.to = options.to||"marak.squires@gmail.com"; | |
options.from = options.from||"obama@whitehouse.gov"; | |
... |
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
function () { | |
if (typeof exports !== 'undefined') { from = exports } | |
else { from = new(Object) }; | |
} |