This file contains hidden or 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
# courtesy of http://heypanda.com/ | |
class TryProxy | |
def initialize(receiving_object) | |
@receiving_object = receiving_object | |
end | |
def method_missing(meth, *args, &block) | |
@receiving_object.nil? ? nil : @receiving_object.send(meth, *args, &block) rescue nil | |
end |
This file contains hidden or 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
posts GET /posts {:controller=>"posts", :action=>"index"} | |
formatted_posts GET /posts.:format {:controller=>"posts", :action=>"index"} | |
POST /posts {:controller=>"posts", :action=>"create"} | |
POST /posts.:format {:controller=>"posts", :action=>"create"} | |
new_post GET /posts/new {:controller=>"posts", :action=>"new"} | |
formatted_new_post GET /posts/new.:format {:controller=>"posts", :action=>"new"} | |
This file contains hidden or 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
/* | |
NAME: Russell Jones | |
DATE: February 21, 2007 | |
PROJECT: LinSprite | |
FILE: GamePanel.java | |
*/ | |
package linsprite; | |
import java.awt.Color; |
This file contains hidden or 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 home='cd ~/' | |
alias ll='ls -lAGhF' | |
alias tld='tail -f log/development.log' | |
alias tlp='tail -f log/production.log' | |
alias ss='script/server' | |
alias ssd='script/server --debugger' | |
alias ssp='script/server -e production' | |
alias sc='script/console' | |
alias scs='script/console --sandbox' | |
alias sg='script/generate' |
This file contains hidden or 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
require '../lib/liquid' | |
class User | |
attr_accessor :name | |
liquid_methods :name | |
def initialize(name) | |
@name = name | |
end | |
end |
This file contains hidden or 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
# from: http://pastie.org/47453 | |
# http://blog.jayfields.com/2007/03/rails-presenter-pattern.html | |
class CompletePresenter < Presenter | |
presentable :account, UserAccount.new | |
presentable :address, Address.new | |
presentable :credential, UserCredential.new | |
def save |
This file contains hidden or 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
# Install logrotate on OS X: | |
# sudo port clean --all logrotate && sudo port install logrotate | |
# Add e.g. this to your crontab: | |
# /opt/local/sbin/logrotate -s /Users/deploy/.logrotate/sites.status /Users/deploy/.logrotate/sites.conf | |
# This file would be sites.conf. | |
# See http://overstimulate.com/articles/logrotate-rails-passenger for more info. | |
daily | |
missingok | |
rotate 30 |
This file contains hidden or 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 hidden or 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 Page < ActiveRecord::Base | |
acts_as_taggable_on :tags | |
has_many :containers, :as => :containable, :dependent => :destroy, :order => "position" | |
has_many :comments, :as => :commentable, :dependent => :destroy | |
before_validation :generate_slug | |
before_validation :set_dates | |
This file contains hidden or 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 CreateTextContainers < ActiveRecord::Migration | |
def self.up | |
create_table :text_containers do |t| | |
t.string :formatting | |
t.text :body | |
t.boolean :is_published | |
t.boolean :is_initial_record, :default => true | |
# ... and all the other revisable fields | |
t.timestamps | |
end |