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
njero - http://neverlet.be | |
sutto - http://blog.ninjahideout.com | |
zapnap - http://blog.zerosum.org | |
tpope - http://tpope.net | |
reinh - http://reinh.com | |
bryanl - http://smartic.us | |
linoj - http://www.vaporbase.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
def menu_item( name, url_options={}, section_url=nil, &block) | |
#debugger | |
current = current_page?(url_options) | |
content = content_tag :li, :class => (current ? 'current' : nil) do | |
link_to(name, url_options) + | |
(block.nil? ? '' : capture(&block)) | |
end | |
block.nil? ? concat(content, binding) : concat(content, block.binding) | |
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
map.resources :accounts, :conditions => { :subdomain => 'www'} | |
map.resource :account, :ony => [:show], | |
:member => { | |
:activate => :get, | |
:change_level => :get, | |
:update_level => :put, | |
:confirm_close => :get, | |
:close => :delete | |
} |
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
# account | |
has_many :projects | |
# project | |
belongs_to :phase | |
# phase | |
# :name => 'open' | |
# whats the right way to do this? doesnt work: |
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
=========================== | |
local development machine | |
=========================== | |
$ script/console production | |
Loading production environment (Rails 2.3.2) | |
>> h = Nokogiri::HTML( open("http://www.google.com") ) | |
=> <!DOCTYPE html> | |
<html> | |
<head> |
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
## steps file | |
def fill_in_upload( resource, field, value ) | |
# adds a resource in the name | |
# when you specify "#{fieldname} upload: files/foo.ext" we convert value into an upload (assumes no field named foo_upload) | |
# when field name is dotted, assumes its an association using *_attributes (eg user.email => [user_attributes][email]) | |
# otherwise works like fills_in | |
# when fills_in fails, tries it as a | |
# - radio select | |
# - dropdown select (TODO) |
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
## app/controllers/application_controller.rb | |
helper :all | |
protect_from_forgery | |
include Authentication | |
## lib/authentication.rb | |
module Authentication | |
filter_parameter_logging :password, :password_confirmation |
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
before_filter :newer_browser_required | |
def newer_browser_required | |
# ref http://pastie.org/203799 | |
# reject MSIE 5.0 and MSIE 6.0 | |
browser_access_denied if request.user_agent =~ /msie\s+[5,6]\.\d+/i | |
end | |
def browser_access_denied |
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
## gem file bogus.rb | |
module ActiveMerchant #:nodoc: | |
module Billing #:nodoc: | |
# Bogus Gateway | |
class BogusGateway < Gateway | |
AUTHORIZATION = '53433' | |
SUCCESS_MESSAGE = "Bogus Gateway: Forced success" | |
... |
OlderNewer