Skip to content

Instantly share code, notes, and snippets.

{
"name": "Octcat",
"awesomeness": 100
}
@xiaotian
xiaotian / production.rb
Created June 8, 2012 04:32
Unicorn init.d script with support for different rvm gemsets
# RAILS_ROOT/config/unicorn.rb
# Search for "# SET ME!" and replace these with your own settings!.
HOW_DEEP_WE_R_FROM_RAILS_ROOT = "../.."
# Set environment to development unless something else is specified
RAILS_ROOT = File.expand_path(HOW_DEEP_WE_R_FROM_RAILS_ROOT, File.dirname(__FILE__))
SHARED_PATH = File.expand_path('../shared', RAILS_ROOT)
ENV['BUNDLE_GEMFILE'] = File.expand_path("#{HOW_DEEP_WE_R_FROM_RAILS_ROOT}/Gemfile", File.dirname(__FILE__))
@xiaotian
xiaotian / gist:1375748
Created November 18, 2011 06:16
Backbone module
(function(){
// Initial Setup
// -------------
// Save a reference to the global object.
var root = this;
// Save the previous value of the `Backbone` variable.
var previousBackbone = root.Backbone;
@xiaotian
xiaotian / gist:1304890
Created October 21, 2011 20:37
ATT sign-in form response cause mechanize 2.0.x to raise
SIGN_IN_FORM_URL = "https://www.att.com/olam/loginAction.olamexecute"
SIGN_IN_AGAIN_URL = "https://www.att.com/olam/loginDisplay.olamexecute"
DATE_REGEX = /\d{2}\/\d{2}\/\d{4}/
def initialize(options = {})
@logger = options[:logger] || Logger.new(STDOUT)
@logger.info "Creating Mechanize instance"
@agent = Mechanize.new do |agent|
agent.user_agent_alias = 'Mac Safari'