View gist:479311
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)
View Relations.js
/*
userData = {
'person1' : [1,2,3,4],
'person2' : [3,4,5,6]
}
*/
First loop over all the userData once and construct an index.
index=[]
View test7.js
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: */*
View test.js
# 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 )
View async_api.js
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();
},
View gist:293954
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) {
View gist:276196
var email = {
send:function (options){
options = options||{};
options.to = options.to||"marak.squires@gmail.com";
options.from = options.from||"obama@whitehouse.gov";
...
View 1.js
function () {
if (typeof exports !== 'undefined') { from = exports }
else { from = new(Object) };
}