Skip to content

Instantly share code, notes, and snippets.

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)]
<ul>
<r:feed:items
url="http://feeds.boingboing.net/boingboing/iBag"
order="creator ASC">
<li><r:feed:link /></li>
</r:feed:items>
function cd {
pushd "$@" > /dev/null
}
#!/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.
#!/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.
#
#!/usr/bin/env ruby
# unmvln
#
# Usage:
#
# unmvln symlink
#
# "undoes" a symlink
# removes the symlink and moves its target to the symlink's original path
# haml + liquid example
#
# James MacAulay 2009
require 'rubygems'
require 'liquid'
require 'haml'
template = <<EOF
if ((typeof Shopify) == 'undefined') {
var Shopify = {};
}
// ---------------------------------------------------------------------------
// Shopify generic helper methods
// ---------------------------------------------------------------------------
Shopify.each = function(ary, callback) {
for (var i = 0; i < ary.length; i++) {
# 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
#!/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