Skip to content

Instantly share code, notes, and snippets.

View tooky's full-sized avatar

Steve Tooke tooky

View GitHub Profile
# ADD LOCAL CONFIGURATION HERE
[diff]
[color]
diff = auto
status = auto
branch = auto
[core]
editor = vim
[alias]
st = status
@tooky
tooky / gist:2137772
Created March 20, 2012 16:16
SSH Config for Simple Pairing Tunnels
# Put this in your ~/.ssh/config
Host pairgate
Hostname <central-pairing-server>
User <your-user-name>
Host pairhost
Hostname <central-pairing-server>
User <your-user-name>
RemoteForward localhost:2222 localhost:22
require 'active_support/inflector'
class Bar; end
def ControllerMixin(model)
model_class = model.classify.constantize
Module.new do
define_method(:"current_#{model}") do
model_class.find(session[:"current_#{model}_id"]) if session[:"current_#{model}_id"]
end
#!/usr/bin/env bash
echo "Trains from Southampton Airport Parkway to Clapham Junction" && curl --silent \
--user-agent "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_5; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.44 Safari/534.7" \
--referer "http://ojp.nationalrail.co.uk/en/s/ldbboard/dep/HYN/GLQ/To" \
"http://ojp.nationalrail.co.uk/en/s/ldb/liveTrainsJson?departing=true&liveTrainsFrom=Southampton+Airport+Parkway&liveTrainsTo=Clapham+Junction&serviceId=" \
| sed -e 's/[{"&;/"}]/''/g' | sed -e 's/ltbrgt/-''/g' | \
awk '{n=split($0,a,","); for (i=6; i<=n-2; i++) { printf("%s %-25s %-20s\n",a[i+0],a[i+1],a[i+2]); i+=5}}'
ack "stub\!?\(:(today|now)" spec
@tooky
tooky / gist:744122
Created December 16, 2010 22:26
test.ru
app = proc do |env|
puts Rack::Request.new(env).params.inspect
[ 200, {'Content-Type' => 'text/plain'}, ["a"] ]
end
run app
:map <leader>rt :!rvm <ruby>@<gemset> exec rspec --no-color %<cr>
:map <leader>rT :execute ":!rvm <ruby>@<gemset> exec rspec --no-color %:".line('.')<cr>
Feature: a quiz
Background:
Given the quiz is configured with the questions:
"""
[
{"key": "foo", "question": "1+1", "answer": "2", "reference-url": "foo.html"},
{"key": "bar", "question": "1x3", "answer": "3", "reference-url": "bar.html"}
]
"""
@tooky
tooky / dojo.rb
Created July 16, 2010 21:18 — forked from anonymous/dojo.rb
require 'rubygems'
require 'spec'
class Account
attr_reader :balance
def self.find(pin)
Accounts[pin]
end
def initialize(ref,balance=0)
.*.sw?