Skip to content

Instantly share code, notes, and snippets.

@timcharper
timcharper / spec_helper.rb
Created June 17, 2009 07:33 — forked from rjharmon/spec_helper.rb
fixed version
require 'rubygems'
require 'spork'
ENV["RAILS_ENV"] ||= 'test'
Spork.prefork do
# Loading more in this block will cause your tests to run faster. However,
# if you change any configuration or code from libraries loaded here, you'll
# need to restart spork for it take effect.
[alias]
co = checkout
b = branch
[branch]
autosetupmerge = true
[user]
email = shhh@shhcom
name = Tim Harper
[gui]
matchtrackingbranch = true
@timcharper
timcharper / class-style-adapter.rb
Created August 15, 2009 18:50
some ways to define test frameworks for Spork
# Specifications:
#
# * Spork integration frameworks should not load any dependencies until #run is invoked
# * Name is derived from class name. Cucumber becomes cucumber.
class Spork::TestFramework::Cucumber < Spork::TestFramework
DEFAULT_PORT = 8990
HELPER_FILE = "features/support/env.rb"
ALIASES = %w[cuc cuke]
rm lib_kernel.so lib_kernel.o
gcc -O2 -fno-common -c -o lib_kernel.o lib_kernel.c
gcc -bundle -undefined dynamic_lookup -o lib_kernel.so lib_kernel.o
[alias]
co = checkout
b = branch
[branch]
autosetupmerge = true
[gui]
matchtrackingbranch = true
pruneduringfetch = true
fontui = -family Tahoma -size 13 -weight normal -slant roman -underline 0 -overstrike 0
recentrepo = /Users/timcharper/www/market
[mergetool "diffmerge"]
cmd = diffmerge --merge --result="$MERGED" "$LOCAL" "$BASE" "$REMOTE"
trustExitCode = false
[merge]
tool = diffmerge
[mergetool]
keepBackup = false
require 'ruby-debug'
require 'socket'
require 'forwardable'
class SporkDebugger
DEFAULT_PORT = 10_123
HOST = '127.0.0.1'
extend Forwardable
def_delegators :state, *[:prepare_debugger, :initialize]
@timcharper
timcharper / gist:198039
Created September 30, 2009 11:44
how to create an empty commit under an existing initial commit
$ rm -rf .git
$ git init
Initialized empty Git repository in /Users/timcharper/project/.git/
$ date > file.txt
$ git add file.txt
$ git commit -m "initial commit"
[master (root-commit) 399a71c] initial commit
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 file.txt
master$
;; vines
(defun find-non-escaped-paren (kind direction)
(cond ((= direction -1) (re-search-backward kind))
((= direction 1) (search-forward kind) (backward-char))
)
(cond ((looking-back "\\\\" 1) (find-non-escaped-open-paren kind direction)))
)
(defun select-previous-paren ()
#!/bin/sh
if [ -z "$1" ]; then
echo "Usage: $0 <commit> <branch>"
echo " branch is optimal and defaults to current"
exit 1
fi
what_ref=$1
branch=$(git symbolic-ref HEAD | sed 's|refs/heads/||')
git reflog show $branch@{now} | while read ref rest; do
if [ -z "$(git rev-list -1 $ref..$what_ref)" ]; then