Skip to content

Instantly share code, notes, and snippets.

View dayvsonlima's full-sized avatar

Dayvson Lima dayvsonlima

View GitHub Profile
# -*- coding: utf-8 -*-
require 'rubygems'
require 'RMagick'
filename = ARGV.first
unless filename
warn "usage: #{$0} <ANIMATION GIF FILE>"
exit 1
end
@dayvsonlima
dayvsonlima / render_view_in_model.rb
Created June 19, 2015 05:23
Renderiza uma view do rails dentro de qualquer model
ApplicationController.new.render_to_string(
:template => "v1/timers/index",
:layout => false,
:locals => { :@timers => Timer.all }
)
function rvm_install(){
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
\curl -sSL https://get.rvm.io | bash -s stable --ruby
echo "source /home/$USER/.rvm/scripts/rvm" >> ~/.bash_profile
echo "source /home/$USER/.rvm/scripts/rvm" >> ~/.zshrc
}
# Funciona perfeitamente bem
<% cache "tags", skip_digest: true do %>
<% current_user.each do |tag| %>
<%= tag.name %>
<% end %>
<% end %>
# Simplesmente não renderiza nada
<% cache ["tags", current_user], skip_digest: true do %>
@dayvsonlima
dayvsonlima / params.rb
Created August 8, 2015 14:58
whitelist_params
params.require(:page).permit(:title, :section_id, :next).tap do |while_listed|
while_listed[:next] = params[:page][:next]
end
@dayvsonlima
dayvsonlima / install-redis.sh
Created October 22, 2015 11:10 — forked from dstroot/install-redis.sh
Install Redis on Amazon EC2 AMI
#!/bin/bash
# from here: http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/
# and here: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
###############################################
# To use:
# wget https://raw.github.com/gist/2776679/04ca3bbb9f085b192f6aca945120fe12d59f15f9/install-redis.sh
# chmod 777 install-redis.sh
# ./install-redis.sh
###############################################
echo "*****************************************"
@dayvsonlima
dayvsonlima / gist:0f4a64b4679cb597a9cc
Created October 26, 2015 12:48 — forked from edvinasbartkus/gist:0e99ea8305a20737f562
Ruby puma.gem install on El Capitan
gem install puma -- --with-cppflags=-I/usr/local/opt/openssl/include --with-ldflags=-L/usr/local/opt/openssl/lib
#!/bin/bash
#
# puma_server puma_server Server Open Source
#
# chkconfig: 345 70 30
# description: puma_server Server is a Application Server Platform
# processname: puma_server
# Source function library.
. /etc/init.d/functions
#!/bin/bash
#
# puma_server puma_server Server Open Source
#
# chkconfig: 345 70 30
# description: puma_server Server is a Application Server Platform
# processname: puma_server
# Source function library.
. /etc/init.d/functions
@dayvsonlima
dayvsonlima / require.build.js
Created November 19, 2015 20:16
require.build.js
({
// appDir: "../../../../tmp/assets"
baseUrl: "../"
, dir: "../../../../tmp/assets/build"
, name: "app"
, cjsTranslate: true
})