Skip to content

Instantly share code, notes, and snippets.

View wilmoore's full-sized avatar
🦄
Proverbs 3:21

Wil (₩) Moore III wilmoore

🦄
Proverbs 3:21
View GitHub Profile
@wilmoore
wilmoore / non-superfluous-var.md
Created September 11, 2012 18:27 — forked from cowboy/tab-indent-rant.js
JavaScript: var statements are not "superfluous"
@wilmoore
wilmoore / latency.markdown
Created June 26, 2012 19:52 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@wilmoore
wilmoore / apology.
Created June 2, 2012 08:26 — forked from unclebob/apology.
Apology to Women Programmers.
Today I gave a keynote at ACCU in Oxford. In the midst of it I made two (count them) two statements that I should have known better than to make. I was describing the late '70s, and the way we felt about the C language at the time. My slide said something like: "C was for real men." Emily Bache, whom I know and hold in high regard, spoke up and said "What about women?". And I said something like: "We didn't allow women in those days." It was a dumb crack, and should either not have been said, or should have been followed up with a statement to the effect that that was wrong headed.
The second mistake I made was while describing Cobol. I mentioned Adm. Grace Hopper. I said something like "May she rest in peace." I don't know that any of the words were actually demeaning, but the tone was not as respectful as it should have been to an Admiral in the United State Navy, and one who was so instrumental in our industry; despite what I feel about Cobol.
I am a 59 year old programmer who was brought up
@wilmoore
wilmoore / gitio
Created May 22, 2012 22:57 — forked from defunkt/gitio
Turn a github.com URL into a git.io URL.
#!/usr/bin/env ruby
# Usage: gitio URL [CODE]
#
# Turns a github.com URL
# into a git.io URL
#
# Copies the git.io URL to your clipboard.
url = ARGV[0]
code = ARGV[1]
@wilmoore
wilmoore / butterflymachine.js
Last active October 5, 2015 00:17 — forked from tjstebbing/butterflymachine.js
Butterfly state machine ( http://harkablog.com/dynamic-state-machines.html ) in javascript
#!/usr/bin/node
/* butterfly state machine */
var Egg = function(species) {
this.species = species;
console.log("An egg");
this.hatch = function() {
@wilmoore
wilmoore / with_5.4.php
Created March 20, 2012 19:23 — forked from ruprict/build_params.php
Retrieve whitelisted set of parameters
<?php
function filter_params(array $params = [], array $whitelist = []) {
return array_map('trim', array_intersect_key($params, array_flip($whitelist)));
}
$params = ['is_admin' => 1, 'name' => ' Bob', 'surname' => 'Smith '];
$whitelist = ['name', 'surname'];
// these are your whitelisted parameters (please don't forget to filter/validate before persisting)
/*
A simple new-line delimited JSON protocol with upgrades.
Receiving Usage:
protocol = require('./frame-protocol');
// parsing data
parser = protocol.Parser();
@wilmoore
wilmoore / README.md
Created October 25, 2011 06:45 — forked from chrisjacob/README.md
Setup GitHub Pages "gh-pages" branch and "master" branch as subfolders of a parent project folder ("grandmaster").

Intro

Description: Setup GitHub Pages "gh-pages" branch and "master" branch as subfolders of a parent project folder ("grandmaster").

Author: Chris Jacob @_chrisjacob

Tutorial (Gist): https://gist.github.com/833223

The Result

@wilmoore
wilmoore / SplClassLoader.php
Created September 18, 2011 07:39 — forked from jwage/SplClassLoader.php
PSR-0 SplClassLoader implementation
<?php
/**
* SplClassLoader implementation that implements the technical interoperability
* standards for PHP 5.3 namespaces and class names.
*
* http://groups.google.com/group/php-standards/web/final-proposal
*
* // Example which loads classes for the Doctrine Common package in the
* // Doctrine\Common namespace.
var
PARALLEL_CONNECTS = 10,
http = require('http'),
sys = require('sys'),
connectionCount = 0,
messageCount = 0;
lastMessages = 0;
function addClient() {