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
# cell widths | |
cell_widths = [160,60] | |
# example data for rows_to_pdf | |
rows_to_pdf = [ | |
['Row Name','200',300','400'], | |
['Row Name','200',300','400'], | |
['Row Name','200',300','400'], | |
['Row Name','200',300','400'], | |
['Row Name','200',300','400'] |
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
# http://henrik.nyh.se/2008/12/git-dirty-prompt | |
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/ | |
# username@Machine ~/dev/dir[master]$ # clean working directory | |
# username@Machine ~/dev/dir[master*]$ # dirty working directory | |
function parse_git_dirty { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | |
} | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/" |
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
# SUPER DARING APP TEMPLATE 1.0 | |
# By Peter Cooper | |
# Link to local copy of edge rails | |
inside('vendor') { run 'ln -s ~/dev/rails/rails rails' } | |
# Delete unnecessary files | |
run "rm README" | |
run "rm public/index.html" | |
run "rm public/favicon.ico" |
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
>> o = Object.new | |
=> #<Object:0x815c45c> | |
>> o.class | |
=> Object | |
>> Class.superclass.superclass | |
=> Object | |
>> Object.class | |
=> Class |
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
# we have | |
admin.resources :meals do |meal| | |
meal.resources :preparation_steps | |
meal.resources :preparation_tools, :collection => {:associate => :post}, | |
:member => {:disassociate => :delete} | |
end | |
# i've added a "sort" method to the preparation_steps controller, and need | |
# to access /admin/meals/:meal_id/preparation_steps/:preparation_step_id/sort |
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 | |
require 'rubygems' | |
require 'daemon-spawn' | |
RAILS_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..')) | |
class DelayedJobWorker < DaemonSpawn::Base | |
def start(args) | |
ENV['RAILS_ENV'] ||= args.first || 'development' | |
Dir.chdir RAILS_ROOT |
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
alias ss="/rails/.shortcuts/ss.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
# requires rails environment to be loaded | |
include ActionView::Helpers::UrlHelper | |
include ActionController::UrlWriter | |
include ActionView::Helpers::TagHelper | |
default_url_options[:host] = 'www.website.com' |
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
task :generate_static_pages => :environment do | |
ActionController::Dispatcher.define_dispatcher_callbacks(true) # same as config.cache_classes = true | |
class PreGenerateController < ApplicationController | |
layout 'secure' | |
def show | |
render :action => params[:id] | |
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
class Hash | |
def requires!(*args) | |
args.flatten.each do |arg| | |
raise ArgumentError, "#{arg} is required" unless has_key?(arg) | |
end | |
end | |
end |
OlderNewer