This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
# add this to your spec helper | |
RSpec.configure do |config| | |
config.treat_symbols_as_metadata_keys_with_true_values = true | |
config.filter_run :focus => true | |
config.run_all_when_everything_filtered = true | |
end | |
# and then use the :focus tag in your specs | |
it "does something awesome", :focus do |
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
require 'rubygems' | |
require 'rack' | |
class Object | |
def webapp | |
class << self | |
define_method :call do |env| | |
func, *attrs = env['PATH_INFO'].split('/').reject(&:empty?) | |
[200, {}, send(func, *attrs)] | |
end |
#!/bin/bash | |
# For RedHat and cousins: | |
# chkconfig: 2345 85 85 | |
# description: Red5 flash streaming server | |
# processname: red5 | |
# Created By: Sohail Riaz ([email protected]) | |
PROG=red5 | |
RED5_HOME=/usr/local/red5 |
# Everything you need to do to get started with Rails 2.3.8 | |
# | |
# As of June 14th, 2010 @ 2:30 p.m. MST | |
# | |
# This gist now features instructions to get Rails 3 up and running with: | |
# - Ruby 1.8.7-p174 | |
# - Bundler 0.9.26 | |
# - Cucumber 0.8.0 | |
# - Rspec 1.3.0 + Rspec-Rails 1.3.2 | |
# - RVM |
# create /etc/default/god file: | |
GOD_CONFIG=/path/to/god.conf | |
#### | |
# create /etc/init.d/god file: | |
#!/bin/sh |
# stolen from http://github.com/cschneid/irclogger/blob/master/lib/partials.rb | |
# and made a lot more robust by me | |
# this implementation uses erb by default. if you want to use any other template mechanism | |
# then replace `erb` on line 13 and line 17 with `haml` or whatever | |
module Sinatra::Partials | |
def partial(template, *args) | |
template_array = template.to_s.split('/') | |
template = template_array[0..-2].join('/') + "/_#{template_array[-1]}" | |
options = args.last.is_a?(Hash) ? args.pop : {} | |
options.merge!(:layout => false) |
require 'etc' | |
require 'campfire' | |
namespace :notify do | |
desc 'Alert Campfire of a deploy' | |
task :campfire do | |
branch_name = branch.split('/', 2).last | |
deployer = Etc.getlogin | |
deployed = `curl -s http://github.com/site/sha`[0,7] | |
deploying = `git rev-parse HEAD`[0,7] |
# multi git user... | |
function iam() { | |
rm ~/.gitconfig | |
rm ~/.ssh/id_rsa | |
rm ~/.ssh/id_rsa.pub | |
ln -s ~/.dotfiles/git/$1.gitconfig ~/.gitconfig | |
ln -s ~/.ssh/$1/id_rsa.pub ~/.ssh/id_rsa.pub | |
ln -s ~/.ssh/$1/id_rsa ~/.ssh/id_rsa | |
} |