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
Check process resque_<app_name> with pidfile /var/www/<app_name>_production/shared/pids/resque.pid | |
start program = "/bin/sh /usr/local/bin/resque_<app_name>-start" as uid capistrano and gid users | |
stop program = "/bin/sh /usr/local/bin/resque_<app_name>-stop" as uid capistrano and gid users | |
group resque | |
if 5 restarts within 5 cycles then timeout | |
alert contact@world_company.com |
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
class MockRedis | |
attr_accessor :store | |
def initialize | |
@store = {} | |
end | |
def flushall | |
@store = {} | |
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
#!/usr/bin/env ruby | |
require "open-uri" | |
def print_status(status, n) | |
# The text of the status code is in [1] | |
case status.to_i | |
when 200 | |
puts "match #{n} http://dl.textmate.org/Application/TextMate_r#{n}.tbz" | |
system "wget http://dl.textmate.org/Application/TextMate_r#{n}.tbz" |
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
http://guides.rubygems.org/make-your-own-gem/ | |
rvm use ruby-1.9.3-p0@lorem --create | |
echo "rvm use ruby-1.9.3-p0@lorem --create" >> lorem/.rvmrc | |
bundle gem lorem | |
gem build lorem.gemspec | |
git tag -a v0.0.1 -m 'version 0.0.1' | |
git push --tags | |
gem push lorem-0.0.1.gem |
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
require 'rubygems' | |
# Set up gems listed in the Gemfile. | |
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('Gemfile', __FILE__) | |
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) | |
require 'rails/all' | |
require 'time_constants' |
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
require 'rubygems' | |
# Set up gems listed in the Gemfile. | |
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('Gemfile', __FILE__) | |
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) | |
require 'rails/all' | |
require 'time_constants' | |
require 'ruby-prof' |
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
#!/usr/bin/env ruby | |
# http://blog.rubybestpractices.com/posts/gregory/011-tap-that-hash.html | |
# http://www.ruby-doc.org/core-1.9.3/Object.html#method-i-tap | |
class TestingObjectTap | |
def legacy | |
results = {} | |
[:x, :y, :z].each do |letter| | |
results[letter] = rand(100) |
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
# Matcher place into spec/support/require_presence_of.rb | |
RSpec::Matchers.define :require_presence_of do |attr| | |
match do |model| | |
model.send("#{attr}=", nil) | |
!model.valid? && model.errors.has_key?(attr) | |
end | |
end | |
# Sample of use |
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
sudo brew doctor | |
# Update HomeBrew | |
cd /usr/local && \ | |
sudo git add . && \ | |
sudo git reset --hard HEAD && \ | |
sudo git pull --rebase | |
#!/usr/bin/env ruby |
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
alias gs='git status && git branch' | |
alias gsa='git status && git branch -a' | |
alias gp='git push && git branch' | |
alias gc='git commit -v -a' | |
alias gcb='git checkout' | |
alias gnb='git checkout -b' | |
alias ga='git add .' | |
alias gl='git log && git branch' | |
alias gln='git log -n 1 && git branch' | |
alias gd='git log --diff-filter=D --summary' |
OlderNewer