Skip to content

Instantly share code, notes, and snippets.

@raarellano
raarellano / batch
Last active August 29, 2015 13:56
Pull remote database from Heroku
heroku pg:pull HEROKU_POSTGRESQL_CYAN local_database_name --app app_name
(Make sure you don't already have a database with that name)
Ex:
heroku pg:pull HEROKU_POSTGRESQL_CYAN rigos_graphics_development --app rigosgraphics
@raarellano
raarellano / bash
Last active August 29, 2015 13:57
Paperclip configurations
rails g paperclip news_post image
@raarellano
raarellano / gemfile.rb
Last active August 29, 2015 13:57
Heroku asset pipeline troubles
gem 'rails_12factor', group: :production
@raarellano
raarellano / alter.sql
Created March 29, 2014 00:05
Restart the auto increment value in Postrgres
ALTER SEQUENCE table_name_id_seq RESTART 500;
@raarellano
raarellano / style.css
Created March 29, 2014 01:41
Align element vertically CSS
.parent{
display: table;
}
.child{
vertical-align: middle;
display: table-cell;
}
@raarellano
raarellano / bash
Created April 1, 2014 16:19
Update all records with callbacks
User.find_each(&:save)
@raarellano
raarellano / batch
Created June 30, 2014 16:10
Pull remote branch
git fetch origin [remote-branch]:[new-local-branch]
@raarellano
raarellano / controller.rb
Created September 8, 2014 20:28
Export to Excel
def participants_export
@model_template = @survey.model_template
@categories = @model_template.categories.wout_overall
@sub_categories = @model_template.sub_categories
#Users + Scores
if params[:start_date] && params[:end_date]
@start_date_searched = params[:start_date].to_s
@start_date = Date.parse(@start_date_searched)
@raarellano
raarellano / 0_reuse_code.js
Last active August 29, 2015 14:07
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@raarellano
raarellano / bash
Created February 26, 2015 21:26
Migrate between Heroku Databases
heroku addons:add pgbackups --app production-app
heroku addons:add pgbackups --app staging-app
heroku pgbackups:capture --app production-app
heroku pgbackups --app production-app
heroku pgbackups:restore HEROKU_POSTGRESQL_EXAMPLE_URL `heroku pgbackups:url --app production-app` --app staging-app