Skip to content

Instantly share code, notes, and snippets.

View pellegrino's full-sized avatar

Vitor Pellegrino pellegrino

View GitHub Profile
@pellegrino
pellegrino / cassandra.rb
Created August 28, 2012 11:13
cassandra 0.6.2 formula
require 'formula'
## This home brew formula installs the archive 0.6.2 version of Cassandra.
class Cassandra <Formula
url 'http://archive.apache.org/dist/cassandra/0.6.2/apache-cassandra-0.6.2-bin.tar.gz'
homepage 'http://cassandra.apache.org'
md5 '9243f3bb0638b53865e4eba792719076'
version '0.6.2'
@pellegrino
pellegrino / coisasparavender.markdown
Created July 11, 2012 17:48
Coisas geek para vender

Coisas para vender

Pessoal eu e minha esposa estamos de mudança e precisamos vender algumas coisas a preço de liquidação por aqui. Todos os produtos estão no Rio de Janeiro/RJ. Caso queira calcular o frete, use o 20560-121 como base.

Quem puder ajudar divulgando e/ou se interessar por algo, só entrar em contato comigo no vitorp@gmail.com. :)

Zyxel NSA 220 R$ 300,00 VENDIDO

vendido

Este aqui é um dos meus xodós. Raríssimo de encontrar aqui no Brasil, tive que pedir para um amigo trazer de fora. É um NAS (Network Attached Storage) que suporta até 2 HDs em RAID 1. Como senão bastasse ser um porto seguro, com backup redundante para teus arquivos essenciais, ele também funciona como um servidor de streaming de media e um cliente de torrent para baixar teus programas e séries favoritos sem precisar deixar teu computador ligado.

tesdas:
@pellegrino
pellegrino / dedupe.rb
Created August 30, 2011 05:56
Find duplicates in a given directory (by @bdunagan)
#!/usr/bin/ruby
# From the post: http://www.bdunagan.com/2010/08/24/dedupe-files-with-50-lines-of-ruby/
# Originally at:
# https://github.com/bdunagan/codebucket/blob/master/dedupe.files.rb
# dedupe.files.rb
require 'rubygems'
require 'sqlite3' # Look at 'http://github.com/luislavena/sqlite3-ruby' then do 'sudo gem install sqlite3-ruby'
require 'digest/sha1'
require 'pathname'

Rails 3 Design Choices - Jose Valim

SOLID Design Principles

Agile Software Development - Bob Martin Book is based on developing in Java/C… some interpretation for ruby.

Single Responsibility Open Closed - open for extension … closed for modification Liskov Substition

@pellegrino
pellegrino / invoker.rb
Created May 18, 2011 21:46
when to mock or not to mock?
module RubyAck
class Invoker
def invoke(ack_string)
IO.popen("ack #{ack_string} --column") { |io| io.readlines }
end
end
end
@pellegrino
pellegrino / unit cancan devise template
Created April 13, 2011 22:04
aplication template for test/unit cancan devise
# create rvmrc file
create_file ".rvmrc", "rvm gemset use #{app_name} --create"
gem "haml-rails"
gem "sass"
# hpricot and ruby_parser required by haml
gem "hpricot", :group => :development
gem "ruby_parser", :group => :development
gem "nifty-generators"
gem "simple_form"
<!DOCTYPE html>
<html>
<head>
<title>Exemplo tabela</title>
<style>
#container {
margin: 0 auto;
width: 800px;
background-color: #e1e1e1;
~/code/petrobras/bookstore jruby-1.3.0 $ gem list
*** LOCAL GEMS ***
actionmailer (2.2.2)
actionpack (2.2.2)
activerecord (2.2.2)
activerecord-jdbc-adapter (0.9.2)
activeresource (2.2.2)
activesupport (2.2.2)
Rails requires RubyGems >= 1.3.1 (you have 1.0.1). Please `gem update --system` and try again.
10/11/15 23:25:40 javax.servlet.ServletException: Could not load Rails. See the logs for more details.
10/11/15 23:25:40 at org.jruby.webapp.RailsFactory.makeObject(RailsFactory.java:139)
10/11/15 23:25:40 at org.jruby.webapp.util.CustomObjectPool.addObjectInternal(CustomObjectPool.java:111)
10/11/15 23:25:40 at org.jruby.webapp.util.CustomObjectPool.access$200(CustomObjectPool.java:15)
10/11/15 23:25:40 at org.jruby.webapp.util.CustomObjectPool$PoolSizeManager.run(CustomObjectPool.java:193)