Skip to content

Instantly share code, notes, and snippets.

View indexzero's full-sized avatar
🗽
✊ Fist in the air in the land of hypocrisy

Charlie Robbins indexzero

🗽
✊ Fist in the air in the land of hypocrisy
View GitHub Profile
@indexzero
indexzero / spawn.js
Created May 9, 2012 01:17
A potential node.js core bug from http://github.com/substack/pix.js
var fork = require('child_process').fork,
spawn = require('child_process').spawn;
//
// This works!
//
// spawn('node', ['server.js']);
//
// This doesn't work
@indexzero
indexzero / proxy-time.js
Created May 9, 2012 21:04
Calculating proxy-time with node-http-proxy
var http = require('http'),
httpProxy = require('http-proxy');
var proxy = new httpProxy.HttpProxy({
host: 'somewhere.on.theinternet.com'
port: 80
});
http.createServer(function (req, res) {
req.start = +new Date();
@indexzero
indexzero / node-static-test.js
Created June 30, 2012 05:33 — forked from phstc/node-static-test.js
vows test/integration/node-static-test.js --spec
var vows = require('vows')
, request = require('request')
, assert = require('assert')
, httpMocks = require('node-mocks-http')
static = require('../../lib/node-static');
var fileServer = new(static.Server)(__dirname + '/../fixtures', {});
var suite = vows.describe('file-server.js');
@indexzero
indexzero / seal.js
Created July 10, 2012 03:01 — forked from zaach/seal.js
#!/usr/bin/env node
/*
* This module can verify that packages installed during development are
* identical to those installed during deployment. The standard npm shrinkwrap
* only ensures that package versions are the same, but does not verify contents.
* This module checks the shasum of the package tarballs downloaded by npm during
* development and deployment to ensure they are the same.
*
* Usage:
@indexzero
indexzero / gist:3299220
Created August 8, 2012 22:04 — forked from Marak/gist:3240974
WIP - Flatironisms

WIP

log all incoming http requests

app.http.before.push(function(req, res){
  app.log.info(req.url);
  res.emit('next');
})
@indexzero
indexzero / LICENSE.txt
Created August 15, 2012 02:34 — forked from aemkei/LICENSE.txt
Lorenz Attractor - 140byt.es
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@indexzero
indexzero / index.html
Created October 24, 2012 08:31 — forked from dfm/LICENSE
XKCD-style plots in d3
<!DOCTYPE HTML>
<html>
<head>
<title>XKCD plots in d3</title>
<script src="http://d3js.org/d3.v2.min.js?2.10.0"></script>
<script src="xkcd.js"></script>
<style>
@indexzero
indexzero / README.md
Created November 6, 2012 16:33
A proposed specification for electronic voting machines

Fixing Electonic Voting

Problems

  1. Each electronic vote is tallied on a machine made by a single vendor.
  2. Each electronic vote has no paper-trail associated with it.
  3. Transmission of electronic votes between precincts is highly vulnerable to tampering

Solution

@indexzero
indexzero / range-error-ftw.js
Created November 28, 2012 09:41 — forked from dherman/range-error-ftw.js
fun with JS arrays
var a = [];
a[Math.pow(2, 32) - 2] = "max index"; // highest non-expando indexed property
console.log(a.length === Math.pow(2, 32) - 1); // true
try {
a.push("whoa", "EVEN MOAR WHOA");
} catch (e) {
console.log(e instanceof RangeError); // true
}
@indexzero
indexzero / vbump.sh
Created December 27, 2012 20:13
My lazy version bump script
VERSION=$1
if [ -z $VERSION ]; then
echo "usage: vbump VERSION"
echo "No version found."
exit 1
fi
echo "git add ."
git add .