Skip to content

Instantly share code, notes, and snippets.

View caironoleto's full-sized avatar
🎯
Focusing

Cairo Noleto caironoleto

🎯
Focusing
View GitHub Profile
# Load plugins (only those I whitelist)
Pry.config.should_load_plugins = false
Pry.plugins["doc"].activate!
# Launch Pry with access to the entire Rails stack.
# If you have Pry in your Gemfile, you can pass: ./script/console --irb=pry instead.
# If you don't, you can load it through the lines below :)
rails = File.join Dir.getwd, 'config', 'environment.rb'
if File.exist?(rails) && ENV['SKIP_RAILS'].nil?
namespace :assets do
task :precompile, :roles => :web do
run "cd #{release_path} && RAILS_ENV=production bundle exec rake assets:precompile"
end
task :cleanup, :roles => :web do
run "cd #{release_path} && RAILS_ENV=production bundle exec rake assets:clean"
end
end
@caironoleto
caironoleto / order.rb
Created November 9, 2011 22:58 — forked from fellix/order.rb
order
class Order
attr_accessor :status
def initialize(adapter = MyWhateverAdapter.new)
@adapter = adapter
end
def pay!
@response = @adapter.pay(self)
end
@caironoleto
caironoleto / gist:1140306
Created August 11, 2011 18:04 — forked from marcusvmsa/gist:1140301
Tentativa de redirecionamento nginx
server_name .px2.com.br ~^(<subdomain>)\.px2\.com\.br$ ;
location / {
rewrite ^(.*)$ http://$subdomain.pixelquadrado.com.br/$1 permanent;
break;
}
<%= form_for(@post) do |f| %>
<% end %>
@caironoleto
caironoleto / gist:953305
Created May 3, 2011 13:12
balancer.load.com
upstream my.balancer.load.com {
server 80.80.80.80:8080;
server 80.80.80.80:8181;
server 81.81.81.81:8080;
server unix:/path/to/your/socket;
}
server {
listen 80;
server_name balancer.load.com
PS1='\n[\t \u] \[\033[1;33m\]\w\a\[\033[0m\]$(__git_ps1 " \[\033[1;32m\](%s)\[\033[0m\]")'
PS1="$PS1 \[\033[1;32m\](\$(~/.rvm/bin/rvm-prompt))\[\033[0m\] \n\$ "
@caironoleto
caironoleto / nginx
Created April 3, 2011 17:44
Arquivo de inicialização do nginx
#! /bin/sh
. /lib/lsb/init-functions
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/nginx
PS="nginx"
PIDNAME="nginx" #lets you do $PS-slave
PIDFILE=$PIDNAME.pid #pid file
PIDSPATH=/var/run
@caironoleto
caironoleto / .vimrc
Created April 3, 2011 15:18
Configuração mais básica do vim
set number
set expandtab
set tabstop=2
set shiftwidth=2
@caironoleto
caironoleto / proc.rb
Created April 2, 2011 02:11
Criação e uso de Proc
proc = Proc.new do |object|
puts object.inspect
end