Skip to content

Instantly share code, notes, and snippets.

Richard Rodger rjrodger

Block or report user

Report or block rjrodger

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
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 / 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 / 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(
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 / 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 / augment.css
Created May 26, 2011
Phonegap 3D compass
View augment.css
#main {
margin: 0px;
width: 480px;
height: 300px;
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 / 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 / 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 / comedy.txt
Created Oct 1, 2012
some cool comedians and shows to checkout
View comedy.txtÓ_Briain
You can’t perform that action at this time.