This file contains hidden or 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 CanonicalHost | |
def initialize(app, host=nil, &block) | |
@app = app | |
@host = (block_given? && block.call) || host | |
end | |
def call(env) | |
if url = url(env) | |
[301, { 'Location' => url }, ['Redirecting...']] | |
else |
This file contains hidden or 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
" Vim filetype detection file | |
" Language: Ruby | |
" Maintainer: Tyler Hunt <[email protected]> | |
" Version: 1 | |
" Last Change: 2010 May 26 | |
" | |
augroup ruby | |
" Ruby metafiles | |
au! BufRead,BufNewFile Gemfile setfiletype ruby | |
au! BufRead,BufNewFile config.ru setfiletype ruby |
This file contains hidden or 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 CoerceBlanks | |
def write_attribute(attr_name, value) | |
if value.is_a?(String) | |
value.strip! | |
value = nil if value.empty? | |
end | |
super | |
end | |
end |
This file contains hidden or 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
def render_once options = nil, extra_options = {}, &block | |
@rendered_once ||= [] | |
args = [options, extra_options] | |
return '' if @rendered_once.include?(args.hash) | |
@rendered_once << args.hash | |
render options, extra_options, &block | |
end |
This file contains hidden or 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
javascript:var%20d=document,x=d.createElement('scr'+'ipt'),z=d.createElement('scr'+'ipt'),b=d.body;x.setAttribute('src','https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js');z.setAttribute('src','http://jackrugile.com/jrumble/js/jrumble.1.0.js');b.appendChild(x);b.appendChild(z);setTimeout(function(){jQuery('body%20*').jrumble({rumbleEvent:'constant'});},500); |
This file contains hidden or 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
source 'http://rubygems.org/' | |
gem 'rails' # was '3.0.7' | |
gem 'coercion', '0.0.2' | |
gem 'gowalla', '0.5.7' | |
gem 'haml', '3.1.1' | |
gem 'sass', '3.1.1' | |
group :development, :test do |
This file contains hidden or 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/ruby | |
require 'fileutils' | |
account = ARGV.first | |
unless account | |
puts "Usage: #{File.basename(__FILE__)} <account>" | |
exit(1) | |
end |
This file contains hidden or 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 CuntCatcher | |
def cunt | |
warn "I'm guessing you meant 'count'?" | |
count | |
end | |
end | |
class Object | |
include CuntCatcher | |
end |
This file contains hidden or 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 'bundler/setup' | |
require 'sinatra/base' | |
require 'rack/contrib' | |
# The project root directory | |
$root = ::File.dirname(__FILE__) | |
class SinatraStaticServer < Sinatra::Base | |
get(/.+/) do |
This file contains hidden or 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/bash | |
args=`getopt r:m $*` | |
if [ $? != 0 ]; then | |
echo "Usage: $0 [-r heroku] [-m]" | |
exit 2 | |
fi | |
set -- $args |
OlderNewer