This file contains 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/env ruby | |
# Chum | |
# | |
# I got an email saying a craigslist post was flagged for removal with a link | |
# here: http://home.comcast.net/~bigtruckn/ so I wrote this quick script to | |
# spam it in hopes of polluting their data in case someone falls for it. | |
require 'rubygems' | |
require 'httparty' | |
require 'ffaker' |
This file contains 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
### | |
# Simple jabber bot to let me talk to users of my minecraft server from gtalk | |
require 'xmpp4r-simple' | |
BOT_USERNAME = '...' | |
BOT_PASSWORD = '...' | |
ADMIN_USERNAME = '...' |
This file contains 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 'spork' | |
Spork.prefork do | |
ENV["RAILS_ENV"] ||= "test" | |
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment') | |
require 'cucumber/rails' | |
require 'cucumber/formatter/unicode' # Remove this line if you don't want Cucumber Unicode support | |
Capybara.default_selector = :css |
This file contains 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 'spork' | |
Spork.prefork do | |
# This file is copied to spec/ when you run 'rails generate rspec:install' | |
ENV["RAILS_ENV"] ||= 'test' | |
require File.expand_path("../../config/environment", __FILE__) | |
require 'rspec/rails' | |
# Requires supporting ruby files with custom matchers and macros, etc, | |
# in spec/support/ and its subdirectories. |
This file contains 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'] || 'progress'} --strict --tags ~@wip" | |
%> | |
default: <%= std_opts %> --drb features | |
wip: --tags @wip:3 --drb --wip features | |
rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip | |
autotest: --drb --color --format progress --strict | |
autotest-all: --drb --color --format progress --strict |
This file contains 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 :spork do | |
desc "start spork in the background" | |
task :start do | |
sh %{spork &} | |
sh %{spork cucumber &} | |
end | |
desc "stop spork" | |
task :stop do | |
`ps -ef | grep bin/spork | grep -v grep | awk '{ print $2 }'`.split.each do |pid| |
This file contains 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
# Fix the problem with github's SSL cert | |
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE | |
git :init | |
# Ignore certain files | |
file '.gitignore', | |
%q{Gemfile.lock | |
.bundle | |
log/*.log |
This file contains 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
>> Visitor.find_or_create_by_date(:date => Time.now.to_date) | |
Visitor Load (0.5ms) SELECT "visitors".* FROM "visitors" WHERE "visitors"."date" = '2011-05-16' LIMIT 1 | |
>> Client.first.visitors.find_or_create_by_date(:date => Time.now.to_date) | |
ArgumentError: Unknown key(s): date |
This file contains 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
# Split a string by regular expression, run the block on each element, then | |
# join the pieces back together with the right separators. | |
# | |
# Example: | |
# >> "Internationalization's awesome.".rejoin(/\W/) {|x| x.length > 2 ? "#{x[0]}#{x.length - 2}#{x[-1]}" : x } | |
# => "I18n's a5e." | |
class String | |
def rejoin(sep, &block) | |
separators = self.scan sep | |
self.split(sep).map(&block).zip(separators).flatten.compact.join |
This file contains 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
## | |
# This thor script launches an applescript that starts new tabs in iTerm for | |
# rails server, rails console and runs the test suite based on the directory | |
# that the script is run from. | |
# | |
# Installation: | |
# thor install rails.rb | |
# | |
# Usage: | |
# thor rails:iterm |
OlderNewer