Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
# For debugging use iptables -v.
IPTABLES="/sbin/iptables"
IP6TABLES="/sbin/ip6tables"
MODPROBE="/sbin/modprobe"
RMMOD="/sbin/rmmod"
ARP="/usr/sbin/arp"
@ozeias
ozeias / specs.watchr
Created February 4, 2011 18:40
specs.watchr
# Run me with:
#
# $ watchr specs.watchr
# --------------------------------------------------
# Convenience Methods
# --------------------------------------------------
def all_spec_files
Dir['spec/**/*_spec.rb']
end
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!"
def call(*args, &block)
evaluate_method(method, *args, &block) if should_run_callback?(*args)
rescue LocalJumpError => e
puts method.inspect
puts args.inspect
puts e.backtrace.inspect
raise ArgumentError,
"Cannot yield from a Proc type filter. The Proc must take two " +
"arguments and execute #call on the second argument."
end
We couldn’t find that file to show.
ActionView::Base.field_error_proc = Proc.new { |html_tag, instance| %[<span class="fieldWithError">#{html_tag}</span>] }
# http://unicorn.bogomips.org/SIGNALS.html
namespace :unicorn do
task :start, :roles => :app do
sudo "god start unicorn"
end
task :stop, :roles => :app do
sudo "god stop unicorn"
end
# http://unicorn.bogomips.org/SIGNALS.html
rails_env = ENV['RAILS_ENV'] || 'production'
rails_root = ENV['RAILS_ROOT'] || "/data/github/current"
God.watch do |w|
w.name = "unicorn"
w.interval = 30.seconds # default
# unicorn needs to be run from the rails root
RAILS_ROOT ||= ENV["RAILS_ROOT"]
namespace :bundle do
task :all => [ :js, :gist_js, :css ]
task :js do
require 'lib/js_minimizer'
paths = []
paths += Dir[RAILS_ROOT + '/public/javascripts/jquery.*.js'].sort
paths += Dir[RAILS_ROOT + '/public/javascripts/github.*.js'].sort
# you'd obviously have more settings somewhere
set :repository, "git@github.com:defunkt/github.git"
set :branch, "origin/master"
namespace :deploy do
desc "Deploy the MFer"
task :default do
update
restart
cleanup