Skip to content

Instantly share code, notes, and snippets.

This gist is the update of this post https://u.osu.edu/hasnan.1/2014/03/30/rails-4-multiple-file-upload-with-carrierwave-nested-form-and-jquery-file-upload/
License MIT
@israelb
israelb / 00-100-colours.gif
Created November 30, 2015 17:24 — forked from grough/00-100-colours.gif
Generate animated gif with ruby + rmagick
00-100-colours.gif
@israelb
israelb / rails_helper.rb
Last active May 15, 2017 04:25
helpers rspec
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rspec/rails'
#require 'spec_helper'
require 'capybara/rspec'
require 'capybara/rails'
require 'capybara/poltergeist'
@israelb
israelb / new_gist_file.md
Created March 2, 2016 04:15 — forked from wrburgess/new_gist_file.md
Upgrading heroku databases
heroku addons:add heroku-postgresql:standard-0 --remote staging
heroku maintenance:on --remote staging
heroku ps:scale worker=0 --remote staging
heroku pg:copy DATABASE_URL HEROKU_POSTGRESQL_PINK --remote staging
heroku pg:promote HEROKU_POSTGRESQL_PINK --remote staging
heroku ps:scale worker=1 --remote staging
heroku maintenance:off --remote staging
@israelb
israelb / tags con git
Created May 6, 2016 13:32
TAGS con git
# Hacer un tag con un comentario
git tag -a v2.5.0 -m "Cambio de pasos del acreditado, más estable el sistema"
# Subir el tag
git push origin v2.5.0
# listar todos los tag
git tag
@israelb
israelb / ls-analytics.js
Last active May 14, 2016 16:11
life and style
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new
Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-1420780-22', 'auto');
ga('send', 'pageview');
</script>
@israelb
israelb / base_controller.rb
Created May 18, 2016 14:41 — forked from dhoelzgen/base_controller.rb
CORS in Rails 4 APIs
class API::V1::BaseController < ApplicationController
skip_before_filter :verify_authenticity_token
before_filter :cors_preflight_check
after_filter :cors_set_access_control_headers
def cors_set_access_control_headers
headers['Access-Control-Allow-Origin'] = '*'
headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'
<script type='text/javascript'>
//...
//...
gptadslots[6]= googletag.defineSlot('/72776159/LifeandStyle/' + var_section, [[300,250]],'box_4').defineSizeMapping(mappingBox).setTargeting('pos',['6']).addService(googletag.pubads());
// ...
//...
</script>
<div id='box_4'>
<script type='text/javascript'>
@israelb
israelb / angularjs_directive_attribute_explanation.md
Created June 20, 2016 19:01 — forked from CMCDragonkai/angularjs_directive_attribute_explanation.md
JS: AngularJS Directive Attribute Binding Explanation

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
# Console postgres command:
$ sudo -u postgres psql
# list users
\du
$ sudo su - postgres
$ psql