Skip to content

Instantly share code, notes, and snippets.

View archfear's full-sized avatar

Dan Dofter archfear

  • BrightHire
  • San Francisco, CA
View GitHub Profile
class Test::Unit::TestCase
def self.should_have_before_filter(expected_method, options = {})
should_have_filter('before', expected_method, options)
end
def self.should_have_after_filter(expected_method, options = {})
should_have_filter('after', expected_method, options)
end
@archfear
archfear / gist:59328
Created February 6, 2009 10:42 — forked from rails/gist:58761
var DateHelper = {
// Takes the format of "Jan 15, 2007 15:45:00 GMT" and converts it to a relative time
// Ruby strftime: %b %d, %Y %H:%M:%S GMT
time_ago_in_words_with_parsing: function(from) {
var date = new Date;
date.setTime(Date.parse(from));
return this.time_ago_in_words(date);
},
time_ago_in_words: function(from) {
@archfear
archfear / archfear.rb
Created February 3, 2009 10:38
Template which configures a generic Rails app with Shoulda, Factory Girl, HAML, etc while commiting each step into git.
# Template which configures a generic Rails app with Shoulda, Factory Girl,
# HAML, etc while commiting each step into git.
#
# Make sure you have Rails 2.3rc1 or greater installed and run:
# rails -d mysql -m http://gist.github.com/raw/57458/06345c42a92048e699af3140ccd28bbcd8915bc5/archfear.rb my_app
# Helper methods
def environment(data = nil, options = {}, &block)
options = { :sentinel => 'Rails::Initializer.run do |config|' }.merge(options)