Skip to content

Instantly share code, notes, and snippets.

Avatar
:bowtie:
Focusing on @planetargon at the moment

Robby Russell robbyrussell

:bowtie:
Focusing on @planetargon at the moment
View GitHub Profile
@robbyrussell
robbyrussell / post-checkout
Created May 10, 2011
post-checkout hook to reload bundler and restart passenger
View post-checkout
#!/bin/sh
#
# Just save this as .git/hooks/post-checkout in your Rails application
#
env ARCHFLAGS="-arch x86_64" bundle install
touch tmp/restart.txt
@robbyrussell
robbyrussell / my.zshrc
Created Apr 26, 2011
oh-my-zsh v0.0.1
View my.zshrc
# my ~/.zshrc BEFORE oh-my-zsh
# Input stuff.
bindkey -e
# History stuff.
setopt HIST_VERIFY
setopt INC_APPEND_HISTORY
setopt SHARE_HISTORY
View B testing with GWO
I'm hoping to run an A/B test on a product preview page, which has URLs like so:
* http://domain.com/products/14/preview
* http://domain.com/products/104/preview
* http://domain.com/products/135/preview
* http://domain.com/products/2045/preview
* http://domain.com/products/2045/preview
We have a variation of the 'preview' view that we want to compare... across all our products.
View gist:541438
# just showing one of our designers how to tighten up some conditionals..
if @foo == "bar" || @foo == "baz" || @foo == "meep"
# do something
end
# can also be written like so...
if ["bar", "baz", "meep"].include?(@foo)
# do something
end
View how-to-answer-unsolicited-phone-calls.textile

This is my script for handling unsolicited sales calls. I can tell by the caller id as they usually come in on our second (unpublished) phone number.

Tips

  • _for best effect… leave off ‘Thank’ to make it sound like the tape already started…

The Script

Thank you for calling Planet Argon. If you know your party’s extension, please say or enter it followed by the pound key.

View to_param.gem.rb
...so we're working on an existing project and we come across comments like this..
def to_param
# Let's use the invoice_no so nobody gets any bright ideas.
self.invoice_no
end
# This class represents the user's shopping cart. Vrrm vrrm!
View OSX: chirp...
# add this to your .oh-my-zsh config for fun in the sun
function chirp() {
growlnotify -t "Chirp Chirp" -m $1;
say -v "Bells" "chirp. chirp. ${1}";
}
# then when you are running a big task and want to be reminded when it finishes (so you don't have to keep checking on it...)
rake your-rake-command && chirp "finished running the command that you were waiting on"
View you-are-doing-it-wrong.rb
# found in a controller...
@lead.update_attribute(:type, 'Customer')
@customer = Customer.find(@lead.id)
View oh 1.8.6...
>> x
=> []
>> x.slice!(10..-1)
=> nil
>> x
=> [nil, nil, nil, nil, nil, nil, nil, nil, nil, nil]
View Setting up RSpactor with Cucumber Support on OS X Leopard
I use Cucumber 0.3.97. Your mileage may vary with older versions.
# install rspactor
sudo gem install guillaumegentil-rspactor
# Change your database.yml to include the following
test: &TEST
database: your_database_name_here
<<: *login
You can’t perform that action at this time.