Skip to content

Instantly share code, notes, and snippets.

View dshaw's full-sized avatar
🦄
Always bet on Node.js ✨

Dan Shaw dshaw

🦄
Always bet on Node.js ✨
View GitHub Profile
@dshaw
dshaw / Procfile
Created October 6, 2011 19:05 — forked from getify/browser-net-output.txt
trouble getting socket.io to work in node
web: node server.js
@dshaw
dshaw / index.html
Created September 21, 2011 21:05 — forked from 3rd-Eden/index.html
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<form id="chat">
<fieldset id="blabla">
</fieldset>
@dshaw
dshaw / gist:1212938
Created September 13, 2011 01:33 — forked from antirez/gist:1211737
How to add cmd-left-arrow and cmd-right-arrow (without shift) key bindings to the mac os x Terminal
app if the Lion install removed this bindings from your system.
1) Open "System Preferences".
2) Go to "Keyboard".
3) Select the "Keyboard Shortcuts" tab.
4) Select "Application Shortcuts" from the list of items in the left.
5) Press "+" to add a new shurtcut.
6) As "Application" select "Terminal", as "Menu Title" use: "Select Next Tab". For the "Keyboard Shortcut" field just select the field and press cmd-right-arrow.
7) Repeat again from step 5, using "Select Previous Tab" as Menu Title and pressing cmd-left-arrow as keyboard shortcut.
http_simple (/bytes/1024) over 1-gbit network, with 700 concurrent connections:
------------------------------------------------------------------------------
windows-0.5.4 : 3869 r/s
windows-latest : 4990 r/s
linux-latest-legacy : 5215 r/s
linux-latest-uv : 4970 r/s
@dshaw
dshaw / gist:1145696
Created August 15, 2011 04:01 — forked from devongovett/gist:1037265
jsondb + msgpack
var arr = [],
obj = {'abcdef' : 1, 'qqq' : 13, '19' : [1, 2, 3, 4]};
for(var i = 0; i < 5000; i++)
arr.push(obj);
// jsondb(arr) looks something like this:
// ["abcdef", "qqq", "19", [1, 13, [1, 2, 3, 4]], [1, 13, [1, 2, 3, 4]]...]
> JSON.stringify(arr).length //original
###
# An implementation of the msgpack serialization format - http://msgpack.org/
# By Devon Govett
# MIT LICENCE
###
class MsgPack
idx = 0
@pack: (data, byteArray = false) ->
@dshaw
dshaw / array.goodies.js
Created July 21, 2011 21:09 — forked from rwaldron/array.extensions.md
Array goodies from twitter rap with David Herman, see wrap up here: http://twitter.com/#!/littlecalculist/status/89855977838485504
// http://twitter.com/#!/littlecalculist/status/89848378682392576
// http://twitter.com/#!/littlecalculist/status/89855977838485504
// Unary Array.from()
Array.from = function( arrayish ) {
return [].slice.call( arrayish );
};
@dshaw
dshaw / console.log.js
Created July 12, 2011 07:29 — forked from tmpvar/.gitignore
A console.log implementation that plays "nice" with large amounts of data. Keeps node alive until the output has flushed to screen.
/*
A console.log that won't leave you hanging when node exits
*/
console.log = function(d) {
var res = process.stdout.write(d + '\n');
// this is the first time stdout got backed up
if (!res && !process.stdout.pendingWrite) {
process.stdout.pendingWrite = true;
@dshaw
dshaw / gist:1072946
Created July 8, 2011 22:08 — forked from technoweenie/gist:1072829
.netrc file so you can push/pull to https git repos without entering your creds all the time
machine github.com
login technoweenie
password SECRET
machine api.github.com
login technoweenie
password SECRET
@dshaw
dshaw / module.js
Created June 22, 2011 05:01 — forked from creationix/module.js
A super simple module system for browsers. Assumes all source files are concatenated and in browser.
function define(name, fn) {
if (!defs) { defs = {}; }
defs[name] = fn;
}
function require(name) {
console.log("Loading " + name);
if (modules && modules.hasOwnProperty(name)) return modules[name];
if (defs && defs.hasOwnProperty(name)) {
if (!modules) { modules = {}; }
var fn = defs[name];