This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# test/spec/mini 2 | |
# http://gist.github.com/25455 | |
# [email protected] | |
# file:lib/test/spec/mini.rb | |
# | |
def context(*args, &block) | |
return super unless (name = args.first) && block | |
require 'test/unit' | |
klass = Class.new(defined?(ActiveSupport::TestCase) ? ActiveSupport::TestCase : Test::Unit::TestCase) do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Dan Croak, February 2008 | |
# updated by Dan Dofter, February 2010 | |
VIEWS_DIR = "#{RAILS_ROOT}/app/views" | |
CSS_DIR = "#{RAILS_ROOT}/public/stylesheets" | |
SASS_DIR = "#{VIEWS_DIR}/stylesheets" | |
def convert_css_to_sass(css_file) | |
if css_file =~ /^(.*)(\.css)$/ | |
basename = $1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
file 'Gemfile', <<-GEMS | |
source 'http://gemcutter.org' | |
gem "rails", "3.0.0.beta3" | |
gem "bson_ext" | |
gem "mongoid", "2.0.0.beta4" | |
gem "haml", "3.0.0.rc.2" | |
gem "compass", "0.10.0.rc4" | |
gem "inherited_resources" | |
group :test do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :assets do | |
namespace :js do | |
desc "Package JavaScript" | |
task :package do | |
puts "Packaging path.js..." | |
repackage_javascript | |
end | |
namespace :package do | |
task "pre-commit" do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Dan Croak, February 2008 | |
# updated by Dan Dofter, February 2010 | |
VENDORED_HAML_BIN = Dir["#{Rails.root}/vendor/gems/haml*/bin"].first | |
VIEWS_DIR = "#{Rails.root}/app/views" | |
CSS_DIR = "#{Rails.root}/public/stylesheets" | |
SASS_DIR = "#{VIEWS_DIR}/stylesheets" | |
def convert_css_to_sass(css_file) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# This script creates an app which launches Google Chrome with a new profile | |
# and allows for running multiple instances of Chrome simultaneously. | |
# | |
# Based on: http://blog.duoconsulting.com/2011/03/13/multiple-profiles-in-google-chrome-for-os-x/ | |
set -e | |
if [ $# == 0 ]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
script_file = File.join(Rails.root, "script", "git_fix_whitespace.sh") | |
desc "Remove trailing whitespace and convert tabs to spaces" | |
task :fix_whitespace do | |
`sh #{script_file} -f` | |
end | |
namespace :fix_whitespace do | |
desc "Installs a git pre-commit hook which removes trailing whitespace and converts tabs to spaces" | |
task :install, :force do |t, args| |
OlderNewer