Skip to content

Instantly share code, notes, and snippets.


John W. Long jlong

View GitHub Profile
jlong / .bash_profile
Created Jan 16, 2009
My bash profile
View .bash_profile
# Environment Variables
export PS1="\u@\h:\w$ "
export PATH=$HOME/bin:/opt/local/bin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/git/bin:$PATH
export MANPATH=$MANPATH:/opt/local/share/man:/usr/local/git/man
export INFOPATH=$INFOPATH:/opt/local/share/info
export EDITOR=vi
export CVS_RSH=ssh
export DEPLOY_TO=staging
# Aliases
View .irbrc
# Completion
require 'irb/completion'
# Benchmarking utility method
def time(times = 1)
require 'benchmark'
ret = nil { |x| { times.times { ret = yield } } }
View fancyzoombehavior.js
FancyZoomImageBehavior = Behavior.create({
initialize: function() {
var src = this.element.readAttribute('href');
var div = $div($img({src: src}));
document.body.insert({after: div});
this.element.writeAttribute('href', '#' + div.identify());
new FancyZoom(this.element);
jlong / case.rb
Created Apr 7, 2009
Ruby allows you to switch on multiple expressions with a case statement. Why do people still insist on using elsif?
View case.rb
when expression_1
when expression_2
when expression_3
View .gitconfig
email =
name = John W. Long
br = branch
ci = commit
cia = commit -a
co = checkout
df = diff
lg = log
View gist:107357
$ tweettail -f railsconf
/Library/Ruby/Gems/1.8/gems/tweettail-1.0.0/lib/tweet-tail/tweet_poller.rb:28:in `initial_json_data': uninitialized constant TweetTail::TweetPoller::Net (NameError)
from /Library/Ruby/Gems/1.8/gems/tweettail-1.0.0/lib/tweet-tail/tweet_poller.rb:10:in `refresh'
from /Library/Ruby/Gems/1.8/gems/tweettail-1.0.0/lib/tweet-tail/cli.rb:30:in `execute'
from /Library/Ruby/Gems/1.8/gems/tweettail-1.0.0/bin/tweettail:10
from /usr/bin/tweettail:19:in `load'
from /usr/bin/tweettail:19
View .vimrc
set runtimepath+=,/usr/share/vim/vimfiles
set backspace=indent,eol,start
if has("vms")
set nobackup " do not keep a backup file, use versions instead
set backup " keep a backup file
" Switch syntax highlighting on, when the terminal has colors
jlong / rounded.sass
Created Jul 4, 2009
SASS mixins for rounding corners
View rounded.sass
!default_rounded_amount ||= 5px
// Round corner at position by amount.
// values for position: "top-left", "top-right", "bottom-left", "bottom-right"
=round-corner(!position, !amount = !default_rounded_amount)
border-#{!position}-radius= !amount
-moz-border-#{!position}-radius= !amount
-webkit-border-#{!position}-radius= !amount
// Round left corners by amount
jlong / Rakefile
Created Jul 21, 2009
rakefile for jekyll
View Rakefile
require 'active_support'
def ok_failed(condition)
if (condition)
puts "OK"
puts "FAILED"
View rounded.sass
background: #c2e5f4
padding: 1.5em 0
margin: 1.5em 0