Skip to content

Instantly share code, notes, and snippets.

View scottwb's full-sized avatar

Scott W. Bradley scottwb

View GitHub Profile
@scottwb
scottwb / install_gems
Created June 10, 2010 17:59 — forked from troelskn/install_gems
Some code I found for installing missing gems.
#!/usr/bin/env ruby
def parse_missing_required(input)
matches = input.match(/Missing these required gems:([\s\S]*)You're running:/)
matches[1].strip.split("\n").map do |line|
m = line.match(/^\s*(\S+)\s+(\S+\s+[0-9.]+)/)
p line if m.nil?
{:name => m[1], :version => m[2]}
end
end
@scottwb
scottwb / gist:398321
Created May 12, 2010 08:09 — forked from cypher/gist:150248
Git pre-commit hook to verify only valid ruby.
#!/usr/bin/env ruby
#
# A hook script to verify that only syntactically valid ruby code is commited.
# Called by git-commit with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# Put this code into a file called "pre-commit" inside your .git/hooks
# directory, and make sure it is executable ("chmod +x .git/hooks/pre-commit")
#

Gist Clients

Want to create a Gist from your editor, the command line, or the Services menu? Here's how.

Editor Support

# If your workers are inactive for a long period of time, they'll lose
# their MySQL connection.
#
# This hack ensures we re-connect whenever a connection is
# lost. Because, really. why not?
#
# Stick this in RAILS_ROOT/config/initializers/connection_fix.rb (or somewhere similar)
#
# From:
# http://coderrr.wordpress.com/2009/01/08/activerecord-threading-issues-and-resolutions/
= Ruby Packaging Standard
The aim of this document is to specify a common structure of how a
Ruby package distributed as source (that is, but not limited to,
development directories, version-controlled repositories, .tar.gz,
Gems, ...) should conform to.
(See RFC 2119 for use of MUST, SHOULD, SHALL.)
== Library files
@scottwb
scottwb / gist:350738
Created March 31, 2010 19:14 — forked from jnunemaker/gist:350680
Alias file stolen from jnunemaker
alias reload='. ~/.bashrc'
alias ea="$EDITOR ~/bin/dotfiles/bash/aliases && reload"
alias ee="$EDITOR ~/bin/dotfiles/bash/env && reload"
alias eh="$EDITOR ~/bin/dotfiles/bash/heroku && reload"
# Processes
alias tu='top -o cpu'
alias tm='top -o vsize'
# Projects