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/sh | |
# Recursively `tail` new and changed files | |
# See https://gist.github.com/1313404#file_watch_recursive.sh for usage | |
watch -d -n 5 'tail `find . -type f \( ! -iname ".*" ! -ipath "*.svn*" \) -newerct "'"15 minutes ago"'" -print`' |
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
# Assumes you have a factory named :customer defined with attributes first_name and last_name | |
Feature: Testing customized factory_girl step definitions | |
As an open source advocate | |
I | |
Want to make sure that my customized step definitions don't throw any errors | |
Scenario: Generating factories from a table | |
Given the following customers exist: | |
| first_name | last_name | | |
| Bob | Smith | |
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
<% | |
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : "" | |
rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}" | |
std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags ~@wip" | |
%> | |
default: <%= std_opts %> features | |
wip: --drb -tags @wip:3 --wip features | |
autotest: --drb --color --format progress --strict | |
rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip |
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
if Rails.env.development? | |
# Make sure we preload the parent and children class in development | |
# since classes aren't pre-cached. Otherwise we get an error when | |
# accessing a child class before we access the parent. | |
%w[kase coaching_kase training_kase alpha_kase].each do |c| | |
require_dependency File.join("app","models","#{c}.rb") | |
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
# A contrived example | |
def a (dividend, divisor) | |
puts "-- Entering!" | |
if dividend >= 5 | |
puts "-- Dividend >= 5!" | |
begin | |
puts "-- Beginning!" | |
puts "-- #{dividend.to_i / divisor.to_i}" | |
rescue => e | |
puts "-- Exception! #{e}" |
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/sh | |
# GENERAL COMMANDS | |
alias l='ls -AHhlp' | |
alias c='clear' | |
alias cx='chmod +x' | |
alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'" | |
alias reload='source ~/.bash_profile' | |
alias release='xattr -d com.apple.quarantine' | |
alias flushdns='sudo discoveryutil udnsflushcaches' |
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
Then /^I should see each item listed in alphabetical order in the items section$/ do | |
@items.each_with_index do |item, index| | |
find(:xpath, "//*[@id='items']/ul[@class='items']/li[#{index+1}]").inspect.should eq(find("li#item-#{item.friendly_id}").inspect) | |
@item = item | |
step "I should see the item listed in the items section" | |
end | |
end | |
Then /^I should( not)? see the item listed in the items section$/ do |negation| | |
assertion = negation ? :should_not : :should |
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
# Generate a password that is 8 - 20 characters in length, and which contains at least one number and one special character | |
# Requires Ruby >= 1.9 | |
def random_password | |
specials = ((32..47).to_a + (58..64).to_a + (91..96).to_a + (123..126).to_a).pack('U*').chars.to_a | |
numbers = (0..9).to_a | |
alpha = ('a'..'z').to_a + ('A'..'Z').to_a | |
%w{i I l L 1 O o 0}.each{ |ambiguous_character| | |
alpha.delete ambiguous_character | |
} | |
characters = (alpha + specials + numbers) |
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
# Create a git branch based off of an arbitrary string. Call the function from | |
# the command line inside a git project and pass in the description (quoted or | |
# not) as the argument. Your description will be converted to slug format and | |
# used to checkout a new branch. Useful for quickly creating branches named | |
# after a ticket # and description. | |
# Example: | |
$ git-mb 123 Add a new feature \(Don't forget the tests\!\) | |
Switched to a new branch '123-add-a-new-feature-don-t-forget-the-tests' |
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
namespace :db do | |
desc "Completely tears down the database, rebuilds it from scratch using your migrations (i.e. ignoring the current schema file), re-seeds the database based on the current environment, and finally prepares the test database" | |
task :bootstrap => ["db:drop", "db:create", "db:migrate", "db:seed", "db:test:prepare"] | |
end |