Skip to content

Instantly share code, notes, and snippets.

View seanhussey's full-sized avatar

Sean Hussey seanhussey

View GitHub Profile
{"lastUpload":"2019-08-17T12:52:32.578Z","extensionVersion":"v3.4.1"}

Keybase proof

I hereby claim:

  • I am seanhussey on github.
  • I am seanhussey (https://keybase.io/seanhussey) on keybase.
  • I have a public key ASBSyjj1FVI5szecGFZqsiFy3nYKfTwpy8R2Wifax2ckCQo

To claim this, I am signing this object:

# config/routes.rb
resources :documents do
scope module: 'documents' do
resources :versions do
post :restore, on: :member
end
resource :lock
end
end
#!/usr/bin/env ruby
# Complete rake tasks script for bash
# Save it somewhere and then add
# complete -C path/to/script -o default rake
# to your ~/.bashrc
# Xavier Shay (http://rhnh.net), combining work from
# Francis Hwang ( http://fhwang.net/ ) - http://fhwang.net/rb/rake-complete.rb
# Nicholas Seckar <nseckar@gmail.com> - http://www.webtypes.com/2006/03/31/rake-completion-script-that-handles-namespaces
# Saimon Moore <saimon@webtypes.com>
sj = read.csv('stocksJobs.csv')
myPalette = c('blue', 'red');
myColors = myPalette [sj$recession]
scaleFunc <- function(vec, factor=5)
factor * (vec - min(vec)) / (max(vec) - min(vec))
pointSize = scaleFunc(sj$jobClm)
plot(as.Date(sj$date), sj$sp500, main="S&P 500", xlab="Date", ylab="Closing", col=myColors, cex=pointSize) #- vector of point sizes
#- Generate legend with colors
git log --name-only --no-merges | grep \.rb$ | sort | uniq -c | sort -nr

Install Postgresql on Mountain Lion

Based on: http://coderwall.com/p/1mni7w

brew install postgresql
initdb /usr/local/var/postgres -E utf8
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/postgresql/9.1.4/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
brew update
brew versions FORMULA
cd `brew --prefix`
git checkout HASH Library/Formula/FORMULA.rb # use output of "brew versions"
brew install FORMULA
brew switch FORMULA VERSION
git checkout -- Library/Formula/FORMULA.rb # reset formula
## Example: Using Subversion 1.6.17
#

If one was inclined to use the acts_as_yaffle pattern, they would probably use the second one, rather than the heavily cargo-culted first one.

require 'benchmark'
module Kernel
alias old_require require
def require(path)
#unless caller.find { |caller_line| caller_line.match /dependencies\.rb/ }
# return old_require(path)
#end