Skip to content

Instantly share code, notes, and snippets.

View bcardarella's full-sized avatar
Out sailing

Brian Cardarella bcardarella

Out sailing
View GitHub Profile
@bcardarella
bcardarella / gist:26302
Created November 18, 2008 22:12
Is God Alive?
task :nietzsche, do
unless system("god status")
puts "God is dead"
system("god -c #{ god_config }")
puts "Long live God"
else
"God is alive"
end
end
@bcardarella
bcardarella / gist:29415
Created November 26, 2008 15:23
Autotest hook for including helper tests
Autotest.add_hook :initialize do |autotest|
autotest.add_mapping %r%^test/(helpers)/.*rb$% do |filename, _|
filename
end
end
@bcardarella
bcardarella / env.rb
Created January 26, 2009 00:06 — forked from jeffrafter/env.rb
Some good Cucumber Stories for Signup and Authentication
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
require 'shoulda'
require 'webrat'
require 'factory_girl'
require 'test/factories/clearance'
require 'clearance/../../shoulda_macros/clearance'
require 'cucumber/rails/world'
Cucumber::Rails.use_transactional_fixtures
@bcardarella
bcardarella / .bash_profile
Created February 4, 2009 22:25
Git Autocompletion
source ~/.git-completion.sh
alias gco='git co'
alias gci='git ci'
alias grb='git rb'
@bcardarella
bcardarella / prepare-commit-msg
Created February 6, 2009 15:27
Commit message rewriter for branches to match Trac tickets
#!/usr/bin/env ruby
#
# Copy this file into .git/hooks and chmod +x
# Acceptable branch formats:
# ticket_1234 -> Refs #1234: your message
# ticket_1234_some_feature -> Refs #1234 - Some Feature: your message
# This should be easier for committing to TRAC against SVN
require 'rubygems'
require 'git'
@bcardarella
bcardarella / .git-dirty.sh
Created February 9, 2009 17:00
Pretty Bash Prompt with colored Git branches
# use with .git-completion.sh
# this script will color the branch name RED if it is dirty
function parse_git_dirty {
if [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]]
then
echo "\e[0;31m"
else
echo "\e[0;00m"
fi
@bcardarella
bcardarella / gist:64930
Created February 16, 2009 00:45 — forked from bryanl/gist:64867
ApplScript to setup Environment from bryanl
tell application "MacVim"
activate
set bounds of the first window to {0, 0, 950, 900}
end tell
tell application "Terminal"
activate
do script "cd ~/Development"
set bounds of the first window to {945, 0, 1440, 450}
@bcardarella
bcardarella / build_ruby19.sh
Created February 18, 2009 20:15 — forked from postmodern/build_ruby19.sh
Ruby 1.8 and 1.9 side-by-side
#!/bin/sh
mkdir -p /usr/local/src && cd /usr/local/src
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p0.tar.bz2
tar -xjvf ruby-1.9.1-p0.tar.bz2
cd ruby-1.9.1-p0
./configure --prefix=/usr --program-suffix=19 --enable-shared
make && make install
[*1..99].reverse.each do |i|
phrase = ["#{i} bottles of beer on the wall",
"#{i} bottles of beer",
"You take one down",
"You pass it around",
"#{i - 1} bottles of beer on the wall.."].join(".. ")
`say #{phrase}`
end
oading autotest/cucumber_rails
Warning: $KCODE is NONE.
/opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/treetop-1.2.5/lib/treetop/ruby_extensions/string.rb:31: warning: method redefined; discarding old indent
/opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/treetop-1.2.5/lib/treetop/compiler/node_classes/character_class.rb:13: warning: useless use of a literal in void context
/opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/treetop-1.2.5/lib/treetop/compiler.rb:5: warning: global variable `$exclude_metagrammar' not initialized
/opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/treetop-1.2.5/lib/treetop/compiler/metagrammar.rb:90: warning: method redefined; discarding old space
/opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/treetop-1.2.5/lib/treetop/compiler/metagrammar.rb:246: warning: method redefined; discarding old space
/opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/treetop-1.2.5/lib/treetop/compiler/metagrammar.rb:629: warning: method redefin