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
#rails template | |
# template.rb | |
run "rm public/index.html" | |
run "mkdir certs" | |
run "cp ../certs/* certs/" | |
generate(:scaffold, "device token:string") | |
generate(:scaffold, "message text:string sound:boolean badge:integer") |
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
# Author: Pieter Noordhuis | |
# Description: Simple demo to showcase Redis PubSub with EventMachine | |
# | |
# Requirements: | |
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby | |
# - a browser with WebSocket support | |
# | |
# Usage: | |
# ruby redis_pubsub_demo.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
gemcutter => redis downloads spec | |
================================= | |
keys | |
---- | |
downloads => global counter for all gem downloads | |
downloads:today => sorted set for downloads from today | |
downloads:rubygem:rails => counter for all rails downloads | |
downloads:version:rails-2.3.5 => counter for all rails 2.3.5 downloads |
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
require 'rubygems' | |
require 'sinatra' | |
require 'redis' | |
# To use, simply start your Redis server and boot this | |
# example app with: | |
# ruby example_note_keeping_app.rb | |
# | |
# Point your browser to http://localhost:4567 and enjoy! | |
# |
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 do_destroy | |
destroy_find_record | |
begin | |
self.successful = @record.destroy | |
rescue Exception => ex | |
flash[:warning] = "Your message here" | |
self.successful = false | |
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
# Add a bunch of twitter users to one of your twitter lists | |
# | |
# use it with a file full of twitter usernames | |
# one name by line | |
# | |
# If the listname indicated doesn't exist it will be created | |
# | |
# Example: $ ruby twitter_lists.rb 'username' 'userpass' 'listname' twitter_users.txt | |
# | |
# Debug mode: $ ruby twitter_lists.rb 'username' 'userpass' 'listname' twitter_users.txt debug |
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
application/activemessage | |
application/andrew-inset | |
application/applefile | |
application/atom+xml | |
application/atomicmail | |
application/batch-smtp | |
application/beep+xml | |
application/cals-1840 | |
application/cnrp+xml | |
application/commonground |
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 valid_email? | |
TMail::Address.parse(email) | |
rescue | |
errors.add_to_base("Must be a valid email") | |
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
ActionMailer::Base.smtp_settings = { | |
:tls => true, | |
:address => "smtp.gmail.com", | |
:port => "587", | |
:domain => "YOURDOMAIN", | |
:authentication => :plain, | |
:user_name => "GOOGLEUSERNAME", | |
:password => "GOOGLEPASSWORD" | |
} |
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
ruby script/plugin install git://github.com/collectiveidea/action_mailer_optional_tls.git | |