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
(.)(.) |
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 User < ActiveRecord::Base | |
validates_uniqueness_of :email, :case_sensitive => false | |
validate :valid_email? | |
private | |
def valid_email? | |
address = EmailVeracity::Address.new(email) |
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
config.gem "heycarsten-email-veracity", :lib => "email_veracity" |
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
begin | |
retryable( :tries => 2 ) do | |
Timeout::timeout(5) do |t| | |
xml_string = open( my_url, "User-Agent" => "Firefox/2.0" ).read | |
end | |
end | |
rescue Timeout::Error | |
LOG.error("Timeout error: #{$!} (#{my_url})") | |
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
God.watch do |w| | |
# ... | |
# Setting ENV variables for your script. | |
w.env = { "WORKER_ID" => "12" } | |
# Allow STDOUT and capture it to a log file. | |
w.log = "path/to/stdout/log/file.log" | |
# ... |
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://feeds.feedburner.com/Flickrblog] | |
name = Flickr Blog | |
face = flickr.gif | |
facewidth = 106 | |
faceheight = 35 | |
[http://blog.360.yahoo.com/rss-1qCkw2Ehaak.hdNZkEAzDrpa4Q--?cq=1] | |
name = Y! 360 US Blog | |
face = y_360.gif | |
facewidth = 195 |
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 show | |
@xyz = Xyz.find( params[:id] ) | |
if @xyz | |
# render page | |
else | |
# render error template or redirect to error page | |
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 SomeModel < ActiveRecord::Base | |
serialize :data | |
xss_terminate :except => [:data] | |
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 CreateRelationships < ActiveRecord::Migration | |
def self.up | |
create_table :relationships do |t| | |
t.integer :user_id | |
t.integer :following_id | |
t.timestamps | |
end | |
add_index( :relationships, [ :user_id, :following_id ], :unique => 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
class UserSession < Authlogic::Session::Base | |
last_request_at_threshold 43200 | |
end |