Skip to content

Instantly share code, notes, and snippets.

@sn
sn / gist:1921824
Created February 27, 2012 06:06
Counting lines of code on a POSIX system
wc -l `find . -iname "*.php"`
@sn
sn / gist:1574791
Created January 7, 2012 13:51
Creating Heroku app using the Cedar Stack
heroku create <app name> --stack cedar
@sn
sn / gist:1352832
Created November 9, 2011 20:12
Nifty way to see what has changed in your GIT repo
git whatchanged --since="yesterday"
git whatchanged --oneline --since="1 week"
@sn
sn / gist:1352657
Created November 9, 2011 19:32
Subtracting days from todays date in Ruby
# 1209600 is the amount of seconds in 14 days
d = Time.new - 1209600
@sn
sn / mio.rb
Created November 4, 2011 09:12 — forked from macournoyer/mio.rb
mio
#!/usr/bin/env ruby
# mio -- minimalist language inspired by Io for your own careful
# and private delectation w/ friends of the the family,
# if you want to.
# usage:
# mio # starts the REPL
# mio mio_on_rails.mio
# (c) macournoyer
module Mio
class Error < RuntimeError
@sn
sn / gist:1336372
Created November 3, 2011 12:24
Detecting Internet Explorer with PHP
<?php
$is_ie = (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') === false)? FALSE : TRUE;
?>