Skip to content

Instantly share code, notes, and snippets.

View cloudhead's full-sized avatar
🌴
On vacation

Alexis Sellier cloudhead

🌴
On vacation
View GitHub Profile
// View function to get all users which have a specific room_id
// in their 'rooms' array.
function(doc) {
if (doc.username) {
for (var i = 0; i < doc.rooms.length; i++) {
emit(doc.rooms[i], { avatar_url: doc.avatar_url, username: doc.username });
}
}
}
function process(items, callback) {
(function iterate(list) {
var item = list.shift();
if (item) {
process.nextTick(function () {
iterate(list);
});
} else {
callback('done!');
@cloudhead
cloudhead / gist:785650
Created January 19, 2011 03:40
WSS fix
From 1e2a3eb3d277f2adc0341fcf38309de7a7e80f93 Mon Sep 17 00:00:00 2001
From: Alexis Sellier <alexis@cloudhead.io>
Date: Tue, 18 Jan 2011 22:39:20 -0500
Subject: [PATCH] make 'readyState' available to CryptoStream
---
lib/tls.js | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/lib/tls.js b/lib/tls.js
From 5adc9addcea62a86562696b783859e116e604b18 Mon Sep 17 00:00:00 2001
From: cloudhead <self@cloudhead.net>
Date: Thu, 5 Aug 2010 13:43:10 -0400
Subject: [PATCH] test querystring.parse with undefined value
---
test/simple/test-querystring.js | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
From 448750c6bb9c6dc872af6dfd5b2445466d8ffe2a Mon Sep 17 00:00:00 2001
From: cloudhead <self@cloudhead.net>
Date: Thu, 5 Aug 2010 03:13:40 -0400
Subject: [PATCH] querystring.parse: handle undefined value properly
---
lib/querystring.js | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/lib/querystring.js b/lib/querystring.js
suite.export(module, {
reporter: {
report: function () { require('sys').print('blah') }
}
});
Benchmarking 127.0.0.1 (be patient)
Server Software: node-static/0.2.0
Server Hostname: 127.0.0.1
Server Port: 8080
Document Path: /lib/node-static.js
Document Length: 6038 bytes
window.dom = {};
dom.dragging = {
element: null,
offset: null,
index: null,
target: null
};
dom.sorting = {
window.onload = function () {
if (! document.querySelectorAll) { // Quick & Dirty way to tell the good browsers from the bad ones.
alert("Please upgrade your browser to view this site.");
}
};
var sys = require('sys'),
path = require('path'),
spawn = require('child_process').spawn;
var arg = path.join(process.cwd(), '**/*.js');
var glob = spawn('ls', [arg]);
var files = [];