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
#!/usr/bin/env ruby | |
# gemmate | |
# open the directory of a rubygem as a project in textmate | |
# responds to anything that `gem which` can handle | |
# e.g.: | |
# gemmate autotest | |
# => `mate /Library/Ruby/Gems/1.8/gems/ZenTest-3.11.0` | |
# gemmate active_record | |
# => `mate /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2` |
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
#!/usr/bin/env ruby | |
# branchmate | |
# opens whichever files you've modified in this git branch compared to master | |
target = ARGV[0] || 'master' | |
p (cmd = "git diff #{target} --name-only") | |
files = `#{cmd}`.split.reject {|f| f =~ /^vendor/} | |
puts files.join("\n") | |
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
function git-revert-batch { | |
echo "$@" | xargs -n1 git revert --no-commit | |
} | |
alias grb='git-revert-batch' | |
# use like: | |
# grb ee5c95a 981da8b | |
# list commits in reverse order, and it's ready to make one neat+tidy revert-commit |
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
# debug_in | |
# call debugger only when the stack trace includes a certain file and/or method | |
# | |
# use like: | |
# debug_in(:file => 'order_test', :method => 'test_taxes_included') | |
# debug_in(:r => /taxes.*included/) | |
# | |
# put in test_helper.rb | |
def debug_in(options = {}) | |
debugger if caller.detect {|c| c =~ /#{(options[:file].to_s + ".rb") if options[:file]}.*#{("`" + options[:method].to_s + "'$") if options[:method]}/ && c =~ (options[:r] || //)} |
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
include ActiveMerchant::Shipping | |
usps = USPS.new(:login => '123JAMES4567') | |
origin = Location.new(:country => 'US', :zip => '90210') | |
destination = Location.new(:country => 'CA', :postal_code => 'K2P 0K3') | |
grams = 100 | |
centimetres = [20,10,10] | |
packages = [Package.new(grams, centimetres)] | |
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
<ul> | |
<r:feed:items | |
url="http://feeds.boingboing.net/boingboing/iBag" | |
order="creator ASC"> | |
<li><r:feed:link /></li> | |
</r:feed:items> | |
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
<ul> | |
<r:feed:items | |
url="http://feeds.boingboing.net/boingboing/iBag" | |
order="creator ASC"> | |
<r:feed:header for="creator"> | |
<h2><r:feed:creator /></h2> | |
</r:feed:header> | |
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
function cd { | |
pushd "$@" > /dev/null | |
} |
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
function bd { | |
if [ -z $1 ]; then | |
n=1 | |
else | |
n=$1 | |
fi | |
pushd +$n > /dev/null | |
} | |
function fd { |
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
#!/usr/bin/env ruby | |
# mvln | |
# | |
# Usage: | |
# | |
# mvln original_location new_location [symlink_location] | |
# | |
# moves the file or directory at original_location to new_location, | |
# then makes a symlink to new_location at symlink_location. |
OlderNewer