Skip to content

Instantly share code, notes, and snippets.

View DanThiffault's full-sized avatar

Dan Thiffault DanThiffault

View GitHub Profile

Keybase proof

I hereby claim:

  • I am DanThiffault on github.
  • I am danthiffault (https://keybase.io/danthiffault) on keybase.
  • I have a public key whose fingerprint is 6387 145A 834E 08F6 2B3A 5F60 A2D4 1BB3 EA59 31D4

To claim this, I am signing this object:

#!/usr/bin/env bash
sudo apt-get -y update
sudo apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev git-core
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
tar -xvzf ruby-1.9.3-p194.tar.gz
cd ruby-1.9.3-p194/
./configure --prefix=/usr/local
make
sudo make install
@DanThiffault
DanThiffault / Cheffile
Created March 20, 2012 11:41
Rails lastmile example
#!/usr/bin/env ruby
#^syntax detection
site 'http://community.opscode.com/api/v1'
cookbook 'build-essential'
cookbook 'ruby_build',
:git => 'git://github.com/fnichol/chef-ruby_build.git', :ref => 'v0.6.2'
cookbook 'rbenv',
@DanThiffault
DanThiffault / en.yml
Created May 6, 2011 07:13
Example yaml file
en:
user_sessions:
new:
title: "Sign in to My Site"
@DanThiffault
DanThiffault / new.html.erb
Created May 6, 2011 07:10
Example template for page title helper
<header>
<%=page_title %>
<hr/>
</header>
<%= render "form" %>
@DanThiffault
DanThiffault / application_helper.rb
Created May 6, 2011 07:05
Rails 3 page title helper
def page_title(title=view_context.t('.title'))
content_tag(:h1, title)
end
class ApplicationController < ActionController::Base
before_filter :infer_bookmarklet_format
include BookmarkletFormat
end
module BookmarkletFormat
Mime::Type.register_alias "text/javascript", :bookmarklet
end
@DanThiffault
DanThiffault / respond_to_bookmarklet.rb
Created February 28, 2011 06:21
Bookmarklet format setup
module BookmarkletFormat
Mime::Type.register_alias "text/javascript", :bookmarklet
def infer_bookmarklet_format
if request.format == :js && request.referer.to_s.match('^' + bookmarklet_url.to_s)
request.format = :bookmarklet unless disable_bookmarklet?
end
end
def disable_bookmarklet?
@DanThiffault
DanThiffault / cucumber.rb
Created February 16, 2011 05:24
Ruby based cucumber file
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
#
# This file was generated by RubyGems.
#
# The application 'cucumber' is installed as part of a gem, and
# this file is here to facilitate running it.
#
if File.exists? "bin/cucumber"
exec "bin/cucumber " + $*.join(" ")