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
# Core | |
class Object | |
def should(matcher) | |
puts matcher.match(self) | |
end | |
end | |
class Matcher | |
def initialize(expected, &block) | |
@expected = expected |
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
# Shoulda activemodel cheatsheet | |
# DB | |
should have_db_column(:title).of_type(:string).with_options(default: 'Untitled', null: false) | |
should have_db_index(:email).unique(:true) | |
# Associations | |
should belong_to :company | |
should have_one(:profile).dependent(:destroy) | |
should have_many(:posts).dependent(:nullify) |
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 'resque/tasks' | |
task "resque:setup" => :environment | |
namespace :queue do | |
task :start => :environment do | |
pidfile = Rails.root.join('tmp', 'pids', 'resque.pid') | |
logfile = Rails.root.join('log', 'resque.log') | |
errlogfile = Rails.root.join('log', 'resque_errors.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
def tip(msg); puts; puts msg; puts "-"*100; end | |
# | |
# 30 Ruby 1.9 Tips, Tricks & Features: | |
# http://www.igvita.com/2011/02/03/new-ruby-19-features-tips-tricks/ | |
# | |
tip "Upgrading to Ruby 1.9 is simple: rvm install 1.9.2 && rvm --default 1.9.2" | |
tip "Ruby 1.9 supports named captures in regular expressions!" |
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
# cap web:deploy:desable & cap web:deploy:enable | |
server { | |
... | |
if (-f $document_root/system/maintenance.html) { set $maintenance 1; } | |
if ($request_uri ~* (jpg|jpeg|gif|js|css)$) { set $maintenance 0; } | |
if ($maintenance) { rewrite ^(.*)$ /system/maintenance.html; break; } | |
... | |
} |
NewerOlder