Skip to content

Instantly share code, notes, and snippets.

View rainux's full-sized avatar

Rainux Luo rainux

View GitHub Profile
@rainux
rainux / deploy.rake
Created July 26, 2012 09:34 — forked from njvitto/deploy.rake
Rakefile to deploy and rollback to Heroku in two different environments (staging and production) for the same app
# Deploy and rollback on Heroku in staging and production
task deploy_staging: ['deploy:set_staging_app', 'deploy:push_staging', 'deploy:restart', 'deploy:tag']
task deploy_production: ['deploy:set_production_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
namespace :deploy do
PRODUCTION_APP = 'YOUR_PRODUCTION_APP_NAME_ON_HEROKU'
STAGING_APP = 'YOUR_STAGING_APP_NAME_ON_HEROKU'
task staging_migrations: [:set_staging_app, :push_staging, :off, :migrate, :restart, :on, :tag]
task staging_rollback: [:set_staging_app, :off, :push_previous, :restart, :on]
@rainux
rainux / .vimrc
Created February 2, 2012 08:47 — forked from sikachu/.vimrc
" Highlight Ruby 1.8.x hash rocket
" This will prevent us to ever write it again
highlight ObsoleteHashRocket ctermbg=red guibg=red
au ColorScheme * highlight ObsoleteHashRocket guibg=red
au BufEnter * match ObsoleteHashRocket /\(:\w\+\s*\)\@<==>/
au InsertEnter * match ObsoleteHashRocket /\(:\w\+\s*\)\@<==>/
au InsertLeave * match ObsoleteHashRocket /\(:\w\+\s*\)\@<==>/
@rainux
rainux / Gemfile
Created March 17, 2010 09:47 — forked from samgranieri/Gemfile
How to get Rails 2.3.5 working with bundler 0.9.3
source :gemcutter
gem 'rails', '~> 2.3.5', :require => nil
@rainux
rainux / gist:325129
Created March 8, 2010 12:40 — forked from rails/gist:58761
Rails DateHelper (partially) ported to Javascript.
var DateHelper = {
// Takes the format of "Jan 15, 2007 15:45:00 GMT" and converts it to a relative time
// Ruby strftime: %b %d, %Y %H:%M:%S GMT
time_ago_in_words_with_parsing: function(from_time, include_seconds) {
var date = new Date;
date.setTime(Date.parse(from_time));
return this.time_ago_in_words(date, include_seconds);
},
time_ago_in_words: function(from_time, include_seconds) {
# mongo_template.rb
# fork of Ben Scofield's Rails MongoMapper Template (http://gist.github.com/181842)
#
# To use:
# rails project_name -m http://gist.github.com/gists/219223.txt
# remove unneeded defaults
run "rm public/index.html"
run "rm public/images/rails.png"
run "rm public/javascripts/controls.js"

Git Workflow

Consider three remote branches origin/master, origin/staging and origin/production. The master is the shared developers' edge. Staging is what is tested before a push to production and production is the code that gets deployed.

New Development