Skip to content

Instantly share code, notes, and snippets.

rjrodger / gist:c3717b2b21a8339a47de
Last active Aug 29, 2015
outline of loadbalance transport
View gist:c3717b2b21a8339a47de
module.exports = function( options ) {
var seneca = this
var plugin = 'loadbalance-transport'
var so = seneca.options()
options = seneca.util.deepextend(
loadbalance: {
workers: [ ... ]
View ey-rr01-c-webuse
members: { alias:'player/members/:team', GET: setcontext },
rjrodger / comedy.txt
Created Oct 1, 2012
some cool comedians and shows to checkout
View comedy.txtÓ_Briain
rjrodger / proporder.js
Created Aug 7, 2012
Workaround for property order inconsistency in Chrome V8.
View proporder.js
Workaround for property order inconsistency in Chrome V8.
Although unspecified by ECMA, most JavaScript engines return
properties in insertion order when you use to iterate through
For example:
rjrodger / nodejs-event-stacktrace.js
Created Jun 7, 2012
better node.js stacktraces from event triggered code
View nodejs-event-stacktrace.js
// the stack trace you really want that tells you how you originally got to the fs.readFile call
var stacktrace = new Error()
fs.readFile( path, encoding, function(err,data) {
if( err ) {
var stackerr = new Error('Unable to read file: '+path+' (error code: '+err.code+')')
stackerr.errno = err.errno
stackerr.code = err.code
rjrodger / draw.html
Created Jun 6, 2011
Little HTML5 mobile web app for drawing on a canvas
View draw.html
<!DOCTYPE html>
<meta name="viewport" content="user-scalable=no,initial-scale=1.0,maximum-scale=1.0" />
body { padding:10px; margin:0px; background-color: #ccc; }
#main { margin: 10px auto 0px auto; }
rjrodger / augment.css
Created May 26, 2011
Phonegap 3D compass
View augment.css
#main {
margin: 0px;
width: 480px;
height: 300px;
rjrodger / streambuffer.js
Created Mar 28, 2011
A utility object that caches inbound HTTP data, allow you to attach your event handlers after you make other asynchronous requests.
View streambuffer.js
function StreamBuffer(req) {
var self = this
var buffer = []
var ended = false
var ondata = null
var onend = null
self.ondata = function(f) {
for(var i = 0; i < buffer.length; i++ ) {
rjrodger / line1030-http.js
Created Feb 8, 2011
possible fix for issue with new Agent code in http.js where Agent in an error state stop working
View line1030-http.js
socket.on('error', function(err) {
debug('AGENT SOCKET ERROR: ' + err.message);
var req;
if (socket._httpMessage) {
req = socket._httpMessage;
} else if (self.queue.length) {
req = self.queue.shift();
assert(req._queue === self.queue);
req._queue = null;
} else {
rjrodger / servegif.js
Created Jan 26, 2011
node.js: serve a 1x1 gif
View servegif.js
var connect = require('connect')
var imgdata = [
0x47,0x49, 0x46,0x38, 0x39,0x61, 0x01,0x00, 0x01,0x00, 0x80,0x00, 0x00,0xFF, 0xFF,0xFF,
0x00,0x00, 0x00,0x21, 0xf9,0x04, 0x04,0x00, 0x00,0x00, 0x00,0x2c, 0x00,0x00, 0x00,0x00,
0x01,0x00, 0x01,0x00, 0x00,0x02, 0x02,0x44, 0x01,0x00, 0x3b
var imgbuf = new Buffer(imgdata)
var server = connect.createServer(
You can’t perform that action at this time.