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
case day_of_week | |
when 'Monday', 'Wednesday' then hours = hours_m_w | |
when 'Tuesday', 'Thursday' then hours = hours_t_th | |
when 'Friday' then hours = hours_f | |
else hours = "Weekend!" | |
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
## Copyright 2009 Rex Luther Corporation. | |
## Licensed under the MIT License | |
## http://www.opensource.org/licenses/mit-license.php | |
def valid_phone | |
return true if phone.blank? | |
phone_formats = [ | |
/^\(\d\d\d\) \d\d\d-\d\d\d\d/, | |
/^\d\d\d\.\d\d\d\.\d\d\d\d/, |
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
## Copyright 2009 Rex Luther Corporation. | |
## Licensed under the MIT License | |
## http://www.opensource.org/licenses/mit-license.php | |
it "should require a phone number have a valid format" do | |
@contact.phone = '(919) 555-1212' | |
@contact.should be_valid | |
@contact.phone = '919-555-1212' | |
@contact.should be_valid |
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 | |
command = '/usr/bin/passenger-memory-stats' | |
memory_limit = 200 # megabytes | |
def running?(pid) | |
begin | |
return Process.getpgid(pid) != -1 | |
rescue Errno::ESRCH | |
return false |
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
<!--#if expr="!${NoAds}" --> | |
<script src="http://www.example.com/foo.js" type="text/javascript"></script> | |
<!--#endif --> |
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
SetEnv NoAds true |
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 post_contact_json | |
contact = { | |
:contact => { | |
:email => 'zzz@example.com', | |
:verify_email => 'zzz@example.com', | |
:first_name => 'joe', | |
:last_name => 'test', | |
:phone => '919-555-1212', | |
:responses_attributes => { |
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
Processing ContactsController#create (for 0.0.0.0 at 2009-03-23 22:17:28) [POST] | |
Parameters: {"action"=>"create", "controller"=>"contacts"} | |
NoMethodError (You have a nil object when you didn't expect it! | |
You might have expected an instance of ActiveRecord::Base. | |
The error occurred while evaluating nil.[]): |
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 create | |
valid_save = true | |
Contact.transaction do | |
## See if we're dealing with a new @contact or an existing contact | |
## FIXME: Error out if email isn't filled in. | |
@contact = Contact.find_by_email( params[:contact][:email] ) | |
if @contact.nil? | |
logger.debug("New contact") |
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
(in /Users/otto/Desktop/Incubator/shallow_routes) | |
communities GET /communities(.:format) {:action=>"index", :controller=>"communities"} | |
POST /communities(.:format) {:action=>"create", :controller=>"communities"} | |
new_community GET /communities/new(.:format) {:action=>"new", :controller=>"communities"} | |
edit_community GET /communities/:id/edit(.:format) {:action=>"edit", :controller=>"communities"} | |
community GET /communities/:id(.:format) {:action=>"show", :controller=>"communities"} | |
PUT /communities/:id(.:format) {:action=>"update", :controller=>"communities"} | |
DELETE /communities/:id(.:format) {:action=>"destroy", :controller=>"communities"} | |
community_forums GET /communities/:community_id/forums(.:format) {:action=>"index", :controller=>"forums"} | |
OlderNewer