Skip to content

Instantly share code, notes, and snippets.

View richardjortega's full-sized avatar

Richard Ortega richardjortega

  • Stealth, exMSFT, exBoeing
  • New York, NY
View GitHub Profile
@nhocki
nhocki / gist:1095522
Created July 20, 2011 18:11 — forked from croaky/gist:1089598
Transfer data from production to staging on Heroku
heroku addons:add pgbackups --remote staging
heroku addons:add pgbackups --remote production
heroku pgbackups:capture --remote production
heroku pgbackups:restore DATABASE `heroku pgbackups:url --remote production` --remote staging
@markysharky70
markysharky70 / gist:1019289
Created June 10, 2011 17:20
Copy your production database to your staging database hosted on Heroku
1) backup production database:
heroku pgbackups:capture --expire --remote production
2) obtain url string to backup from step 1:
heroku pgbackups:url --app production_app_name --remote production_app_branch_name
3) transfer backup from production to staging app:
heroku pgbackups:restore DATABASE 'production_app_backup_url_string_from_step_2' --app production_app_name --app staging_app_branch_name
@lukaszsagol
lukaszsagol / gist:973516
Created May 15, 2011 20:43
typhoeus example
hydra = Typhoeus::Hydra.new :max_concurrency => 5
urls = %w(http://www.google.com/ http://engadget.com/
http://rubyonrails.org/ http://railscasts.com/)
responses = []
urls.each do |url|
req = Typhoeus::Request.new url
req.on_complete do |resp|
if resp.success?
responses << resp.body
@aliang
aliang / application_controller.rb
Created February 1, 2011 23:53
Force SSL on Devise routes only, then redirect back
class ApplicationController < ActionController::Base
# Tell Devise to redirect after sign_in
def after_sign_in_path_for(resource_or_scope)
some_url(:protocol => 'http')
end
# Tell Devise to redirect after sign_out
def after_sign_out_path_for(resource_or_scope)
some_url(:protocol => 'http')
end
first_name last_name employer
Fred Flintstone Bedrock Quarry
Clark Kent The Daily Planet
Ralph Kramden Metro Bus
Joe Friday LAPD
David Hansson 37Signals
Jim Weirich EdgeCase
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')