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
#!/usr/bin/env ruby | |
fn = ARGV[0] | |
if !fn | |
puts "Usage: #{$0} file.mustache" | |
puts | |
exit | |
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
git config --global alias.lg "log --graph --since='1 week ago' --pretty=format:'%Cblue%h%Creset %cr %Cgreen%an%Creset %s'" |
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
git config --global alias.lg "log --date=relative --since='1 week ago' --pretty -… | |
…-graph" |
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
# | |
# cucumber.yml | |
# | |
# Filter which features are run with each profile by the file extension | |
webrat: --require features/steps/common --require features/support/webrat_env.rb --exclude selenium.feature --format progress | |
selenium: --require features/steps/common --require features/support/selenium_env.rb --exclude webrat.feature --format progress | |
# | |
# features/support/env.rb |
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
# Use on_change :property { # do stuff here } | |
# to make changes to models after a property has been changed | |
module OnChange | |
def on_change(attribute, &block) | |
after_save do | |
block.call if send("#{attribute}_changed?") | |
end | |
end | |
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
module ApplicationHelper | |
def local_time(time) | |
capture_haml do | |
haml_tag :span, time.utc.to_s, :class => 'time' | |
end | |
end | |
def local_date(time) | |
capture_haml 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
class CanonicalHost | |
def initialize(app, host=nil, &block) | |
@app = app | |
@host = (block_given? && block.call) || host | |
end | |
def call(env) | |
if url = url(env) | |
[301, { 'Location' => url }, ['Redirecting...']] | |
else |
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 CanonicalHost | |
def initialize(app, host=nil, &block) | |
@app = app | |
@host = (block_given? && block.call) || host | |
end | |
def call(env) | |
if url = url(env) | |
[301, { 'Location' => url }, ['Redirecting...']] | |
else |
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
# bootstrapper.rb | |
# Rails Bootstrapper using rails template | |
# Based on Extended Bort -http://github.com/laktek/extended-bort/tree/master | |
# Ideal to use when building a comprehensive web app | |
# Uses Braid to track remote repos. | |
# by Lakshan Perera | |
# Use Braid to track remote git or svn repos. | |
def braid(command, repo, options={}) | |
other_params = "" |
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
# extracted from marty andrew's presentation on ruby static code analysis | |
# http://www.slideshare.net/martin_j_andrews/code-quality-analysis | |
require 'flog' | |
require 'flay' | |
require 'roodi' | |
require 'roodi_task' | |
require 'metric_fu' | |
desc "Analyze for code complexity" |
NewerOlder