Skip to content

Instantly share code, notes, and snippets.

@rjrodger
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: [ ... ]
@rjrodger
rjrodger / nginx.conf
Created Sep 30, 2010
nginx alias for PhoneGap www folder
View nginx.conf
server {
...
location /myapp/ {
alias /Users/richard/Projects/MyApp/www/;
}
...
}
@rjrodger
rjrodger / iphone.html
Created Sep 30, 2010
iPhone Mobile Safari full screen meta tags
View iphone.html
<meta name="viewport" content="user-scalable=no,initial-scale=1.0,maximum-scale=1.0" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
@rjrodger
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
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
rjrodger / augment.css
Created May 26, 2011
Phonegap 3D compass
View augment.css
#main {
margin: 0px;
width: 480px;
height: 300px;
}
@rjrodger
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()
Error.captureStackTrace(stacktrace)
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
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 for..in to iterate through
them.
For example:
@rjrodger
rjrodger / comedy.txt
Created Oct 1, 2012
some cool comedians and shows to checkout
View comedy.txt
http://en.wikipedia.org/wiki/Dara_Ó_Briain
http://desbishop.net/
http://en.wikipedia.org/wiki/Russell_Howard
http://en.wikipedia.org/wiki/Michael_McIntyre
http://en.wikipedia.org/wiki/Have_I_Got_News_For_You
http://en.wikipedia.org/wiki/Mock_the_Week
http://www.bbc.co.uk/programmes/b008cnxn
http://www.thecatlaughs.com/
View ey-rr01-c-webuse
seneca.act({role:'web',use:{
name:name,
prefix:'/well/:event/',
pin:{role:name,cmd:'*'},
map:{
whoami:{GET:setcontext},
leader:{GET:setcontext},
members: { alias:'player/members/:team', GET: setcontext },
You can’t perform that action at this time.