Skip to content

Instantly share code, notes, and snippets.

Scenario "Never going to give you up" do
Given "We are no strangers to love"
And "You know the rules and so do I"
When "a full commitment is what I'm thinking of"
Then "you wouldn't get this from any other guy"
And "I just wanna tell you how I'm feeling"
And "I gotta make you understand" do
Rick.should_not_receive(:give_up).with(:you)
Rick.should_not_receive(:let_down).with(:you)
Rick.should_not_receive(:run_around_and_desert).with(:you)
@erithmetic
erithmetic / poor_mans_download_progress_meter
Created December 17, 2008 20:31
Great download status script when using wget with -q option ;)
#!/bin/bash
while [ true ] ; clear; do ls -la $1; sleep 1; done
Feature: Your Mom
In order to infuriate our users
We will insult their mothers
Scenario: Housing
Given your mom is so fat
When she sits around the house
Then she really sits around the house
Scenario: Dangerous cereal
# Script to import data from mymilemarker.com mpg data to the Road Trip fuel economy tracking app
# Steps for OS X users:
# 1. Download this file to your user directory
# 2. Log into mymilemarker.com
# 3. Go to http://mymilemarker.com/vehicles/car-name/histories.xml?all=1
# 4. Download the XMl file to histories.xml.colloquytranscript.xml in your home directory
# 5. Open Terminal app
# 6. type "gem install hpricot"
# 7. type "ruby fuel.rb"
# 8. type "cat history.csv | pbcopy"
@erithmetic
erithmetic / gist:180638
Created September 4, 2009 00:34 — forked from gdi/gist:180470
# Rake task for listing all Cucumber features defined
namespace :cucumber do
task :features do
list = { :given => [], :when => [], :then => [] }
files = Dir.glob(File.join(File.dirname(__FILE__),'features','**','*.rb')).each do |f|
File.readlines(f).select { |l| l =~ /\s*[^#]?\s*(Given|When|Then)\s\// }.each do |line|
line =~ /(Given|When|Then)\s+(\/\^?)?([^$\/]+)(\$?\/)?/
type = $1.downcase.to_sym
name = "#{$1} #{$3}".strip
@erithmetic
erithmetic / gist:183394
Created September 9, 2009 01:43
Quick and Dirty Rails Seeding
# Save as db/seed.rb
#
# Run with script/runner db/seed.rb
def unique_attributes
{
MyModel => [:name],
MyOtherModel => [:category, :type]
}
end
@erithmetic
erithmetic / macvim
Created December 5, 2009 16:40
MacVim bash script
#!/bin/sh
/Applications/MacVim.app/Contents/MacOS/MacVim $*
#!/usr/bin/env ruby
HELP = <<EOS
git-wtf displays the state of your repository in a readable and easy-to-scan
format. It's useful for getting a summary of how a track branch relates to a
remote server, and for understanding how feature branches and relate to
integration branches.
git-wtf can show you:
- How a branch relates to the remote repo, if it's a tracking branch.
@erithmetic
erithmetic / sudoh
Created January 12, 2010 03:59
Command to run the last command as a sudo command
#!/bin/bash
#
# Wish you had just run the last command as sudo? sudoh will do it!
#
# INSTALLATION
#
# On Mac OS X, add the following to your ~/.bash_profile:
# shopt -s histappend
# export PROMPT_COMMAND='history -a'
# export HISTIGNORE="sudoh"
@erithmetic
erithmetic / autounit
Created January 27, 2010 15:45
autotest for PHPUnit
# Prereqs:
# * Ruby
# * gem install watchr
# Usage:
# copy autounit to php project directory
# run watchr autounit
watch('test/.*Test\.php') do |md|
puts "\e[H\e[2J" #clear console