Skip to content

Instantly share code, notes, and snippets.

View mwhooker's full-sized avatar

Matthew Hooker mwhooker

  • tbd
  • San Francisco
View GitHub Profile
<html><body>
<h1>Find a Unique Username</h1>
<p>With a limit of 15 characters</p>
<form method="get">
<label>First Name <input name="first_name" /></label>
<label>Last Name <input name="last_name" /></label>
<label>Quit after <input name="end" value="111" /></label>
class LinkedList[T] {
private var head : Node = _
def insert(key : String, value : T) {
if (head == null) {
head = new Node(key, value)
} else {
var node : Node = head
while (node.next != null) {
node = node.next
@mwhooker
mwhooker / save.py
Created November 17, 2009 02:00 — forked from ieure/save.py
from contextlib import contextmanager
@contextmanager
def save(obj, attrs=None):
"""Save attributes of an object, then restore them.
Example:
import breakfast
with save(breakfast, ('eggs', 'bacon')):
breakfast.Eggs = lambda: "Eggs"
import re
def country_finder(adj):
f = open('Acarnania.txt')
countries = []
for line in f:
results = re.split(',' , line.strip())
if len(results) >=2:
countries.append(results)
print countries
@mwhooker
mwhooker / jam.js
Created March 29, 2011 07:00 — forked from marlun/jam.js
var fs = require('fs'),
path = require('path'),
glob = require('glob').glob;
exports = module.exports = function jam(options) {
options = options || {};
var patterns = options.patterns || [];
var root = options.root || path.join(__dirname, 'public');
var namespace = options.namespace || 'JST';
var output = options.output || path.join(root, 'jst.js');
@mwhooker
mwhooker / gist:969121
Created May 12, 2011 18:15
ambient steampunk
good discussion at
http://www.last.fm/group/Steampunk/forum/42787/_/376230
some interesting first starts
http://sites.google.com/site/chinasteamengine/
http://www.lifesdecay.com/Home/Home.html
your life will get very strange for a little while after clicking this link
http://www.youtube.com/watch?v=cycXIYdFGsQ
input:
one
two
three
a
b
c
@mwhooker
mwhooker / bzr_tip.py
Created August 2, 2011 02:43
print timestamp of last revision for each file in bzr branch
"""Takes a list of files under bazaar version control and lists path and
timestamp of last commit.
Usage: bzr_tip.py $(find . -name "*.py") | sort -n
line output format is <timestamp> <file>@<last revision>
"""
import sys
(venv)[matt@dhcp-179:cloudscaling/aws-compat]$ cat !$ (09-12 20:48)
cat .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
[remote "origin"]
url = git@github.com:cloudscaling/aws-compat.git
@mwhooker
mwhooker / express_fail.js
Created October 7, 2011 19:32
failing express project
var express = require('express')
var app = express.createServer();
app.get('/pass', function(req, res){
res.send({foo: 'bar'});
});
app.get('/fail', function(req, res){