Skip to content

Instantly share code, notes, and snippets.

View krsmurata's full-sized avatar

Kristopher Murata krsmurata

View GitHub Profile
E se os Sistemas Operacionais fossem mulheres?
Linux é uma mulata gostosona mas meio feia de rosto com quem voce tem
que conversar horas no boteco sobre ecologia e o embargo a Cuba antes
de levar pra cama.
Mac é uma patricinha, linda mas cheia de vontades, só sai com quem tem
carro importado. Todo mundo admira mas poucos tem acesso.
= Christian Neukirchen's Ruby Style Guide
[ http://github.com/chneukirchen/styleguide/blob/master/RUBY-STYLE ]
You may not like all rules presented here, but they work very well for
me and have helped producing high quality code. Everyone is free to
code however they want, write and follow their own style guides, but
when you contribute to my code, please follow these rules:
== Formatting:
#!/usr/bin/ruby
# Usage: ruby juros.rb aplicacao_mensal juros meses
aplicacao = ARGV[0].to_f
juros = ARGV[1].to_f
meses = ARGV[2].to_i
def calcula_juros(aplicacao, juros, meses)
@total = 0.0
for i in 1..meses do
# see it in action: http://www.flickr.com/photos/krsmurata/4733844609/sizes/l/
# with timestamp
minimal_prompt_command() {
if [ $? -eq 0 ]; then
local ARROW_COLOR="\[\e[1;32m\]"
else
local ARROW_COLOR="\[\e[1;31m\]"
fi
local CWD_GIT_BRANCH="`git branch 2> /dev/null | grep '^*' | sed -E 's/^\* (.+)$/\1/'`"
~> ruby jn-parser.rb
Tue, 29 Nov -1 20:21:32 -0338 # Nerdcast 215 – Profissão: Autor
Tue, 29 Nov -1 20:21:32 -0338 # Nerdcast 214 – Copa 2010 – Cala Boca, Galvão!
Tue, 29 Nov -1 20:21:32 -0338 # Nerdcast 213 – Especial Dia dos Namorados 2010
Tue, 29 Nov -1 20:21:32 -0338 # Nerdcast 212 – Seinfeld: Tudo sobre o nada
Tue, 29 Nov -1 20:21:32 -0338 # Nerdcast 211 – Profissão: Programador
Tue, 29 Nov -1 20:21:32 -0338 # Nerdcast 210 – LOST: 5 teorias antes do fim
Tue, 29 Nov -1 20:21:32 -0338 # Nerdcast 209 – Douglas Adams – A Vida, o Universo e Tudo Mais
Tue, 29 Nov -1 20:21:32 -0338 # Nerdcast 208 – World of MMORPG FL
Tue, 29 Nov -1 20:21:32 -0338 # Nerdcast 207 – Bêbado e na Mão do Palhaço 2
~> ruby jn-parser.rb
Thu, 01 Jul 2010 01:45:14 -0400 # WordPress 3.0 rodando e probleminhas de feed
Wed, 30 Jun 2010 20:44:14 -0400 # Concurso da Blizzard vai dar edição de colecionador de Starcraft II!
Wed, 30 Jun 2010 20:03:35 -0400 # LOST: Como deveria ter acabado [SPOILERS]
Wed, 30 Jun 2010 18:47:14 -0400 # Jerry Bruckheimer considerando sequencia de Top Gun
Tue, 29 Jun 2010 17:47:27 -0400 # Capcom diz que novos consoles devem surgir até 2012
Tue, 29 Nov -1 20:21:32 -0338 # Assista AGORA ao trailer de Tropa de Elite 2!
Tue, 29 Jun 2010 16:29:57 -0400 # Vídeo de Portal 2 apresenta novo personagem
Tue, 29 Nov -1 20:21:32 -0338 # Nova animação da DC anunciada
Tue, 29 Jun 2010 00:42:44 -0400 # Caverna do Jedi – 16
# usage: rails new APP_NAME -m http://gist.github.com/629240.txt -TJ
# the -T drops test-unit and the -J drops prototype
gem "mysql2"
gem "haml"
gem "sass"
gem "compass"
gem "rspec-rails", "2.0.1"
root@dev:~# ls -la /usr/local/bin/
total 28
drwxr-xr-x 2 root root 4096 2010-11-15 11:55 .
drwxr-xr-x 11 root root 4096 2010-11-15 11:55 ..
-rwxr-xr-x 1 root root 1263 2010-11-15 11:55 rvm
-rwxr-xr-x 1 root root 589 2010-11-15 11:55 rvm-auto-ruby
-rwxr-xr-x 1 root root 3327 2010-11-15 11:55 rvm-prompt
-rwxr-xr-x 1 root root 992 2010-11-15 11:55 rvm-shell
-rwxr-xr-x 1 root root 438 2010-11-15 11:55 rvmsudo
root@dev:~# ls -la /usr/local/rvm/bin/
tell application "Skype"
send command "SET USERSTATUS DND" script name "pomodoro"
end tell
tell application "Mail" to quit
tell application "Tweetie" to quit
@krsmurata
krsmurata / clear_logs.rb
Created February 15, 2012 14:36
Clear development logs
if Rails.env.development?
MAX_LOG_SIZE = 10.megabytes
logs = [ File.join(Rails.root, 'log', 'development.log'), File.join(Rails.root, 'log', 'test.log') ]
logs.each do |log|
log_size = File.size?(log).to_i
if log_size > MAX_LOG_SIZE
$stdout.puts "Removing Log: #{log}"
`rm #{log}`