Skip to content

Instantly share code, notes, and snippets.

@raarellano
raarellano / .Acts as List for Rails 3 & 4.md
Last active December 30, 2015 08:49
Gives order to lists through a drag and drop functionality.
@raarellano
raarellano / remote_radio.html.haml
Created December 17, 2013 22:16
Submit Radio button with a remote form in a Rails 4 app.
= form_for(@edit_single_response, remote: true, authenticity_token: true, :html => {:class => 'form-horizontal form-for-responses'} ) do |f|
- question.response_options.each do |response_option|
.form-group
%label.radio
= f.radio_button :response_option_number, response_option.id, :onclick => '$(this).trigger("submit.rails")'
%span
=response_option.text
@raarellano
raarellano / heroku_precompile_issue
Last active December 31, 2015 21:29
If there are problems with Heroku precompiling assets run the following. Only for Rails 4
heroku labs:enable user-env-compile
Or
heroku labs:disable user-env-compile
heroku labs:enable user-env-compile
@raarellano
raarellano / Gemfile
Created January 16, 2014 15:17
Best in place
gem 'best_in_place'
@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)