Skip to content

Instantly share code, notes, and snippets.

View fabianoalmeida's full-sized avatar
🎯
Focusing

Fabiano Almeida fabianoalmeida

🎯
Focusing
  • São Paulo, Brazil
View GitHub Profile
@fabianoalmeida
fabianoalmeida / gist:1293163
Created October 17, 2011 17:21
rspec load error
fabianoalmeida $ autotest -n
loading autotest/rails_rspec2
/Users/fabianoalmeida/.rvm/rubies/ruby-1.9.2-p180/bin/ruby -rrubygems -S /Users/fabianoalmeida/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.7.0/bin/rspec --tty '/Users/fabianoalmeida/Desenvolvimento/captie/spec/controllers/cities_controller_spec.rb' '/Users/fabianoalmeida/Desenvolvimento/captie/spec/controllers/countries_controller_spec.rb' '/Users/fabianoalmeida/Desenvolvimento/captie/spec/controllers/languages_controller_spec.rb' '/Users/fabianoalmeida/Desenvolvimento/captie/spec/controllers/options_controller_spec.rb' '/Users/fabianoalmeida/Desenvolvimento/captie/spec/controllers/organizations_controller_spec.rb' '/Users/fabianoalmeida/Desenvolvimento/captie/spec/controllers/questions_controller_spec.rb' '/Users/fabianoalmeida/Desenvolvimento/captie/spec/controllers/quizzes_controller_spec.rb' '/Users/fabianoalmeida/Desenvolvimento/captie/spec/controllers/roles_controller_spec.rb' '/Users/fabianoalmeida/Desenvolvimento/captie/spec/controllers/states
@fabianoalmeida
fabianoalmeida / gist:1385366
Created November 22, 2011 10:21
Git log decorate as a pretty way!
git log --graph --pretty="format:%C(yellow)%h%C(cyan)%d%Creset %s => %C(green)%an%C(white), %C(red)%ar%Creset"
@fabianoalmeida
fabianoalmeida / gist:1393599
Created November 25, 2011 14:05
Polymorphic Association Example
### PaymentWay
class PaymentWay < ActiveRecord::Base
belongs_to :payable, :polymorphic => true
end
class CreatePaymentWays < ActiveRecord::Migration
def change
create_table :payment_ways do |t|
t.string :name
t.references :payable, :polymorphic => true # Will create two columns => :payable_id and :payable_type
@fabianoalmeida
fabianoalmeida / gist:1400989
Created November 28, 2011 16:32
All Bank List
Banco Número
Banco Do Brasil S.A. 0001
Banco Central Do Brasil 0002
Banco Da Amazonia S.A. 0003
Banco Do Nordeste Do Brasil S.A. 0004
Banco Nacional Do Desenvolvimento Econom 0007
Banco Do Estado De Sao Paulo S.A. - Bane 0008
Sc Credit Suisse Hg 0011
Banco Standard De Investimentos S.A. 0012
Sc Senso 0013
@fabianoalmeida
fabianoalmeida / gist:1675767
Created January 25, 2012 10:32
Update entries from Feedzirra
require 'activesupport'
require 'feedzirra'
feed = Feedzirra::Parser::RSS.new
feed.feed_url = "http://feeds.feedburner.com/gizmodobr?format=xml" # URL from my database
feed.last_modified = Time.utc(2012, 1, 1) # Feed from my database
entry = Feedzirra::Parser::RSSEntry.new
entry.url = "http://feedproxy.google.com/~r/gizmodobr/~3/5YLB2D-K49w/story01.htm" # Last entry URL on my database
@fabianoalmeida
fabianoalmeida / gist:1986116
Created March 6, 2012 12:51
Commands line on Linux
# List all process
ps -axf
# Kill a specific process
sudo kill <process_id>
# List all ips and ports
sudo netstat -ln
@fabianoalmeida
fabianoalmeida / nginx.conf
Created March 6, 2012 13:27
Nginx Configuration
#user nobody;
worker_processes 1;
error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
@fabianoalmeida
fabianoalmeida / etc__rc.local
Created March 6, 2012 13:47
Starts Servers Configuration (Ubuntu)
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
@fabianoalmeida
fabianoalmeida / render_protovis.js
Created September 19, 2012 14:21
Render Protovis
function renderProtovis(hash) {
if(hash == "" || hash == null){
return
}
var keys = Array();
var data = Array();
var max = 0;
for (index in hash) {
keys.push(hash[index].date_local);
Dinr::Application.routes.draw do
ActiveAdmin.routes(self)
devise_for :admin_users, ActiveAdmin::Devise.config
devise_scope :user do
get '/login' => 'devise/sessions#new'
get '/logout' => 'devise/sessions#destroy'
end