Skip to content

Instantly share code, notes, and snippets.

View tatiC's full-sized avatar

Tati Carvalho tatiC

  • Untried Possibilities
  • Brasil - Rio de Janeiro
View GitHub Profile
@tatiC
tatiC / subtract.rb
Created February 6, 2011 23:15
ruby strange output
p1 = File.open('people1.txt').readlines
p2 = File.open('people2.txt').readlines
puts p1 - p2
=begin
ruby-1.9.2-p136 :006 > f1 = File.open('people1.txt').readlines
=> ["tatiana\n", "ana lucia\n", "sergio ney \n", "marco aurelio \n"]
ruby-1.9.2-p136 :007 > f2 = File.open('people2.txt').readlines
=> ["tatiana\n", "cantido \n", "marco aurelio\n", "renata"]
ruby-1.9.2-p136 :001 > ['tatiana','ana lucia', 'sergio ney', 'marco aurelio' ] - ['tatiana','cantidio', 'marco aurelio', 'renata' ]
=> ["ana lucia", "sergio ney"]
@tatiC
tatiC / heroku_commands.rb
Created October 13, 2011 20:23
heroku_commands.rb
$ heroku help
=== General Commands
help # show this usage
version # show the gem version
login # log in with your heroku credentials
logout # clear local authentication credentials
list # list your apps
@tatiC
tatiC / resque-rails.txt
Created April 19, 2012 17:55
Usando resque-redis numa applicação Rails
refs: https://github.com/defunkt/resque
Instalar redis
Instalar resque
Gemfile: gem 'resque', 'versão', :require => 'resque/server'
Criar arquivo:
lib/tasks/resque.rake
@tatiC
tatiC / uninitialized-constant-rakedsl
Created May 11, 2012 15:09
uninitialized-constant-rakedsl
http://stackoverflow.com/questions/6085610/ruby-on-rails-and-rake-problems-uninitialized-constant-rakedsl
Rakefile
require 'rake'
require 'rake/dsl_definition'
@tatiC
tatiC / find_free_port.rb
Created July 10, 2012 04:22
Free ports
# aliases
# alias scripts="cd /Users/tatic/Dropbox/my_projects/myscripts; ls -la"
# alias freeports="scripts;ports >> ports.txt;ruby freeports.rb;rm ports.txt"
# by: TatiCarvalho 2012
# In the command-line: freeports
# v1.1
@tatiC
tatiC / inspiration
Created July 21, 2012 01:59
inspiration
‘Not all those who wander are lost.’ ~J.R.R. Tolkien (:zenhabits)
‘Bizarre travel plans are dancing lessons from God.’ ~Kurt Vonnegut (:zenhabits)
‘In proportion as he simplifies his life, the laws of the universe will appear less complex, and solitude will not be solitude, nor poverty poverty, nor weakness weakness.’ ~Henry David Thoreau (:zenhabits)
"É preciso viver, não apenas existir." (Plutarco)
@tatiC
tatiC / refactoring_example.rb
Created July 21, 2012 18:49
Refactoring exercise from "Programming workout" by Michal Taszycki
# This is a simple refactoring exercise.
#
# What to do?
#
# 1. Look at the code of the class CorrectAnswerBehavior
# 2. Try to see what it does by running `ruby refactoring_example.rb`
# 3. Record characterisation tests by running `ruby refactoring_example.rb --record`
# 4. Make the code beautiful;)
# 5. You are allowed to modify only the code between markers (REFACTORING START/REFACTORING END).
# 6. Test must pass! You can run them with command `ruby refactoring_example.rb --test`
@tatiC
tatiC / refactoring_example.rb
Created July 25, 2012 16:41 — forked from mehowte/refactoring_example.rb
Simple refactoring exercises and 2 minute commits version - with updated characterisation tests.
# This is a refactoring exercise.
#
# What to do?
#
# I. Simple refactoring
# 1. Look at the code of the class CorrectAnswerBehavior
# 2. Try to see what it does by running `ruby refactoring_example.rb`
# 3. Record characterisation tests by running `ruby refactoring_example.rb --record`
# 4. Make the code beautiful;)
# 5. You are allowed to modify only the code between markers (REFACTORING START/REFACTORING END).
@tatiC
tatiC / gist:3192905
Created July 28, 2012 11:19
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt