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
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
#!/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. |
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 | |
# vault | |
# | |
# Usage: | |
# | |
# vault file_name [vault_name] | |
# | |
# requires mvln from http://gist.github.com/54392 to be in the same directory as this file. | |
# |
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 | |
# unmvln | |
# | |
# Usage: | |
# | |
# unmvln symlink | |
# | |
# "undoes" a symlink | |
# removes the symlink and moves its target to the symlink's original path |
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
# haml + liquid example | |
# | |
# James MacAulay 2009 | |
require 'rubygems' | |
require 'liquid' | |
require 'haml' | |
template = <<EOF |
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
if ((typeof Shopify) == 'undefined') { | |
var Shopify = {}; | |
} | |
// --------------------------------------------------------------------------- | |
// Shopify generic helper methods | |
// --------------------------------------------------------------------------- | |
Shopify.each = function(ary, callback) { | |
for (var i = 0; i < ary.length; i++) { |
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
# Enumerable#mash (MAp_to_haSH) | |
# | |
# %w{a baz buzz}.mash {|word| [word, word.length]} | |
# # => {"a"=>1, "baz"=>3, "buzz"=>4} | |
module Enumerable | |
def mash | |
self.inject(Hash.new) do |hash,e| | |
key, value = yield(e) | |
hash[key] = value | |
hash |
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 | |
# | |
# .git/hooks/pre-commit | |
# make sure to make executable: | |
# chmod u+x .git/hooks/pre-commit | |
git diff HEAD | grep ^+.*debugger | |
if [ $? -ne 0 ] | |
then |