Skip to content

Instantly share code, notes, and snippets.

@israelb
israelb / Gemfile
Created June 26, 2013 22:48 — forked from cblunt/Gemfile
Amazon S3 - Carrierwave
# ...
gem 'carrierwave'
gem 'fog', '~> 1.0.0' # Need to specify version, as carrierwave references older (0.9.0) which doesn't allow configuration of Rackspace UK Auth URL

Deploying Rails to Linode

Installing Ruby Enterprise Edition, Apache, MySQL, and Passenger for deploying Rails 3.0 applications.

Get a Linode, and set it up with Ubuntu 10.04 LTS so that you have till April 2013 to get updates. Once the Linode is formatted, boot it and continue on.

Set up an 'A' record in your DNS, pointing to the IP of your Linode. I'm using demo.napcs.com here.

Initial setup

@israelb
israelb / gist:6123212
Created July 31, 2013 15:48
Using MySQL command line with MAMP
Start MAMP or MAMP PRO
Start the server
Open Terminal (Applications -> Utilities)
Type in: (one line)

/Applications/MAMP/Library/bin/mysql --host=localhost -uroot -proot
@israelb
israelb / 01.shell
Created July 31, 2013 22:27
Accesar a un SSH
chmod 600 Emision.pem
ssh -i certificado.pem user@my_ip
@israelb
israelb / 01.sh
Last active December 20, 2015 13:09
Configurando un vagrant con chef y capistrano para el deploy
# Instalar primero VirtualBox
# Despues instalar la gema vagrant
gem install vagrant
# Descargar una BOX
vagrant box add base http://files.vagrantup.com/lucid32.box
# Iniciar vagrant, este hara un archivo llamado Vagrantfile en la ruta de donde se ejecuto
vagrant init
@israelb
israelb / index.md
Created September 3, 2013 04:54 — forked from rstacruz/index.md

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

@israelb
israelb / README.md
Created September 5, 2013 14:43 — forked from keikubo/README.md

Nginx + Unicorn for Rails on Rackhub

Description:

This script enables you to launch your Rails application in production environment (port:80) with Nginx and Unicorn.

Installation:

Please make sure that your Gemfile in your rails application includes unicorn.

@israelb
israelb / deploy.rb
Created September 17, 2013 14:40 — forked from bkutil/deploy.rb
after "deploy:symlink", "deploy:restart_workers"
after "deploy:restart_workers", "deploy:restart_scheduler"
##
# Rake helper task.
# http://pastie.org/255489
# http://geminstallthat.wordpress.com/2008/01/27/rake-tasks-through-capistrano/
# http://ananelson.com/said/on/2007/12/30/remote-rake-tasks-with-capistrano/
def run_remote_rake(rake_cmd)
rake_args = ENV['RAKE_ARGS'].to_s.split(',')
@israelb
israelb / all.god
Created October 2, 2013 18:53 — forked from nragaz/all.god
PID_DIR = '/srv/myapp/shared/pids'
RAILS_ENV = ENV['RAILS_ENV'] = 'production'
RAILS_ROOT = ENV['RAILS_ROOT'] = '/srv/myapp/current'
BIN_PATH = "/home/rails/.rvm/gems/ree-1.8.7-2010.02/bin"
God.log_file = "#{RAILS_ROOT}/log/god.log"
God.log_level = :info
%w(unicorn resque).each do |config|
God.load "#{RAILS_ROOT}/config/god/#{config}.god"
@israelb
israelb / braces.rb
Last active December 25, 2015 08:09
def braces(expresion)
if expresion.length % 2 != 0
puts '0'
return
end
opening = [ '(', '[', '{']
closing = [ ')', ']', '}']
stack = []