Skip to content

Instantly share code, notes, and snippets.

@quamen
quamen / gist:59047
Created February 5, 2009 22:09 — forked from rails/gist:58761
var DateHelper = {
// Takes the format of "Jan 15, 2007 15:45:00 GMT" and converts it to a relative time
// Ruby strftime: %b %d, %Y %H:%M:%S GMT
time_ago_in_words_with_parsing: function(from) {
var date = new Date;
date.setTime(Date.parse(from));
return this.time_ago_in_words(date);
},
time_ago_in_words: function(from) {
Note: UK People start here: http://twitter.com/timmeh/status/1351833678
HOW TO ENABLE TETHERING ON YOUR 3.0 iPHONE
Step 1: Check if you own a 3G iPhone. If you're on EDGE (as I am): sorry. Tethering does not seem to work with EDGE phones.
Step 2: Check to see if AT&T is your carrier. If it is: sorry. AT&T will not let you tether.
Step 3: Navigate to ~/Library/iTunes/iPhone Carrier Support. Notice the spaces in that last folder name! If you're at the command line, use backslashes to escape the spaces, i.e. cd ~/Library/iTunes/iPhone\ Carrier\ Support. You will find a file with an ipcc extension. Copy that file: e.g. cp foo.ipcc foo.ipcc.original. This creates a backup for when you mess up.
@quamen
quamen / gist:558365
Created August 31, 2010 01:22 — forked from NZX/gist:558363
class Robot
def self.rock!
system(%(osascript -e 'tell application "iTunes" to play track named "Robot Rock"'))
end
end
@quamen
quamen / valid.rb
Created October 11, 2012 03:40 — forked from notahat/valid.rb
Testing fail?
# ve a class that delegates functionality to a couple of objects that it
# constructs. I want to test this in isolation. I want to make sure that the
# objects are constructed with the right arguments. I also want to make sure
# that the results from the objects are handled correctly.
#
# I'm finding it hard to structure the code and test in a way that isn't
# cumbersome. What's below works, but it feels like a lot of stubbing and setup
# for something the should be simpler.
#
# Anyone got a better approach for this?