This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
# what about this? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FilterableEnumerable | |
def initialize(original) | |
@original = original | |
end | |
def ==(value) | |
@original.select { |v| v == value } | |
end | |
def method_missing(sym, *args, &block) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module GeoKit | |
module Geocoders | |
class FakeGeocoder < Geocoder | |
def self.locations | |
@locations ||= {} | |
end | |
def self.geocode(location) | |
loc = GeoLoc.new | |
if locations.key?(location) |
NewerOlder