Skip to content

Instantly share code, notes, and snippets.

View robbyrussell's full-sized avatar
:bowtie:
Focusing on @planetargon at the moment

Robby Russell robbyrussell

:bowtie:
Focusing on @planetargon at the moment
View GitHub Profile
@robbyrussell
robbyrussell / i-am-sorry.txt
Created March 20, 2012 19:56
apology ideas for @sqoot
Dear friends, we are truly sorry. You're right. We live in a bubble
and have a lot to learn. We need to do some soul searching and
practice mindfulness going forward. We hope that, in time, you'll
forgive us.
#!/bin/sh
# config options
CURRENT_DATE=`date +%Y%m%d`;
BACKUP_DIRECTORY="/Users/robbyrussell/Backups/Databases/Contiki"
DATABASE_NAME="contiki_live_$CURRENT_DATE"
echo $DATABASE_NAME;
DATABASE_USER="root"
MYSQL_PATH="mysql"
MYSQL_IMPORT_PATH="mysqlimport"
@robbyrussell
robbyrussell / time_until_in_words.rb
Created June 29, 2011 19:59
Before I start hacking on this myself... anyone have a Ruby method to produce this?
# return strings like:
# "3 months and 14 days" until"...
# "1 year and 11 days until"...
#
def time_until_in_words(future_date)
future_date - Date.today
# magic!
end
# Before I start hacking on this myself... anyone have a Ruby method to produce this?
# "3 months and 14 days" until"...
# "1 year and 11 days until"...
def time_until_in_words(future_date)
future_date - Date.today
# magic!
end
@robbyrussell
robbyrussell / we-love-github.txt
Created June 22, 2011 21:55
Oh My Zsh loves github
When I released Oh My Zsh to share with coworkers, I decided to toss it on Github instead of sending them a tarball. If you had told me that less than two years later, we'd be approaching 900 forks and I'd have accepted patches from 150 different people... I'd have rolled my eyes and laughed.
Yet, I find myself leading such a project, which now receives more pull-requests submissions than I can keep up with. Github has provided tools that enabled me to distribute some management of the project with other people, which means that I don't have to be a huge bottle neck in the process. Even if I don't keep up (ie., take a vacation), people can easily fork, make their tweaks, and share their patches with the rest of the community. This allows me to get engaged with the community when it's convenient for me.
Outside of that, the people who use Oh My Zsh appear to be huge fans of the project. It seems to make a positive difference in how people feel about working with their terminal environment. Being able to re
@robbyrussell
robbyrussell / post-checkout
Created May 10, 2011 16:57
post-checkout hook to reload bundler and restart passenger
#!/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 / B testing with GWO
Created January 5, 2011 21:18
open question...
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.
@robbyrussell
robbyrussell / move-to-front-of-line.rb
Created February 27, 2009 00:21
moving an item in an Array to the front while preserving original order for rest of Array
class Array
def move_to_front_of_line(x)
return [ self[x] ] | self
end
end
# 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

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.