Skip to content

Instantly share code, notes, and snippets.

#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")
# 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
#
@towanda
towanda / gist:312351
Created February 23, 2010 16:14 — forked from qrush/gist:296921
gemcutter stats
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
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!
#
def do_destroy
destroy_find_record
begin
self.successful = @record.destroy
rescue Exception => ex
flash[:warning] = "Your message here"
self.successful = false
end
end
# 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
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
def valid_email?
TMail::Address.parse(email)
rescue
errors.add_to_base("Must be a valid email")
end
ActionMailer::Base.smtp_settings = {
:tls => true,
:address => "smtp.gmail.com",
:port => "587",
:domain => "YOURDOMAIN",
:authentication => :plain,
:user_name => "GOOGLEUSERNAME",
:password => "GOOGLEPASSWORD"
}
ruby script/plugin install git://github.com/collectiveidea/action_mailer_optional_tls.git