Skip to content

Instantly share code, notes, and snippets.

View joshuaclayton's full-sized avatar

Josh Clayton joshuaclayton

View GitHub Profile
require 'rubygems'
# what about this?
#!/bin/sh
branch=$(git branch 2>/dev/null | grep ^\*)
[ x$1 != x ] && tracking=$1 || tracking=${branch/* /}
git config branch.$tracking.remote origin
git config branch.$tracking.merge refs/heads/$tracking
echo "tracking origin/$tracking"
@joshuaclayton
joshuaclayton / git-track
Created December 10, 2008 20:30 — forked from sstephenson/git-track
Auto-tracking of git branches
#!/bin/sh
branch=$(git branch 2>/dev/null | grep ^\*)
[ x$1 != x ] && tracking=$1 || tracking=${branch/* /}
git config branch.$tracking.remote origin
git config branch.$tracking.merge refs/heads/$tracking
echo "tracking origin/$tracking"
# 1) Point *.example.com in your DNS setup to your server.
#
# 2) Setup an Apache vhost to catch the star pointer:
#
# <VirtualHost *:80>
# ServerName *.example.com
# </VirtualHost>
#
# 3) Set the current account from the subdomain
class ApplicationController < ActionController::Base
Webrat.configure do |config|
config.mode = :selenium
end
class Cucumber::Rails::World
def wait_for_ajax(timeout = 15000)
selenium.wait_for_condition "window.Ajax.activeRequestCount == 0", timeout
end
def wait_for_effects(timeout = 15000)
commit ed20f4dcc656ac55adbe9515466ef19d102e9ead
Author: Pratik Naik <pratiknaik@gmail.com>
Date: Thu Mar 5 22:45:04 2009 +0000
should_be_fucking_restful
diff --git a/lib/shoulda/action_controller.rb b/lib/shoulda/action_controller.rb
index 4719851..3723c72 100644
--- a/lib/shoulda/action_controller.rb
+++ b/lib/shoulda/action_controller.rb
class FilterableEnumerable
def initialize(original)
@original = original
end
def ==(value)
@original.select { |v| v == value }
end
def method_missing(sym, *args, &block)
# autocompletion for ruby_test
# # works with tu/tf aliases
# # see also ~/bin/ruby_test.rb
_ruby_tests() {
if [[ -n $words[2] ]]; then
compadd `ruby_test -l ${words[2]}`
fi
}
compdef _ruby_tests ruby_test
alias tu="ruby_test unit"
module GitCommands
class ShellError < RuntimeError; end
@logging = ENV['LOGGING'] != "false"
def self.run cmd, *expected_exitstatuses
puts "+ #{cmd}" if @logging
output = `#{cmd} 2>&1`
puts output.gsub(/^/, "- ") if @logging
expected_exitstatuses << 0 if expected_exitstatuses.empty?
module GeoKit
module Geocoders
class FakeGeocoder < Geocoder
def self.locations
@locations ||= {}
end
def self.geocode(location)
loc = GeoLoc.new
if locations.key?(location)