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: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 / 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: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: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: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: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:1293103
Created October 17, 2011 17:05
Gems used in Captie project
Gems included by the bundle:
* ZenTest (4.5.0)
* actionmailer (3.1.0)
* actionpack (3.1.0)
* activemodel (3.1.0)
* activerecord (3.1.0)
* activeresource (3.1.0)
* activesupport (3.1.0)
* ansi (1.3.0)
* archive-tar-minitar (0.5.2)
@fabianoalmeida
fabianoalmeida / installing_oracle_unix
Created August 29, 2011 14:31
Installing a gem whose need the environment - Oracle
# Linux
env LD_LIBRARY_PATH=$LD_LIBRARY_PATH ARCHFLAGS="-arch i386" gem install ruby-oci8
# Mac
env DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH ARCHFLAGS="-arch x86_64" gem install ruby-oci8
@fabianoalmeida
fabianoalmeida / gist:1126084
Created August 4, 2011 19:59
Install MySQL on Ubuntu and setting external access
# Install MySQL
sudo apt-get install mysql-server
# After set the root password
# Configure the file:
sudo vi /etc/mysql/my.conf
# And add this configuration to bind-address attribute (under [mysqld])
bind-address = 0.0.0.0
@fabianoalmeida
fabianoalmeida / gist:1116156
Created July 30, 2011 23:33
Installing PostgreSQL on Ubuntu for Rails - gem install pg
# Before it's necessary install a lib
sudo apt-get install libpq-dev
# And then
gem install pg
More: http://i.justrealized.com/2010/install-pg-gem-postgresql-ubuntu/