Skip to content

Instantly share code, notes, and snippets.

View rafaelp's full-sized avatar

Rafael Lima rafaelp

View GitHub Profile
@rafaelp
rafaelp / gist:0fa400f8cefec64834c1
Created October 10, 2014 13:19
Exemplo de colorização
Exemplo de `tag` no github
```ruby
codigo = Ruby.new(:param1,:param2)
# comentario
```
```bash
$ export TOKEN=meutoken
$ ls -al
@rafaelp
rafaelp / snippets
Last active August 29, 2015 14:18
Chamada para snippets pro Graffiti da HE:labs
Vamos colocar alguns snippets de código no Graffiti da HE:labs
https://www.dropcam.com/p/helabs
Sugira o seu que ele pode entrar na parede, mas tem que ser até final do dia 31 de março (terça)!!
Pode ser qualquer linguagem.
Ex:
while working{
coffee++;
}
@rafaelp
rafaelp / h.sh
Created September 6, 2010 17:22
Shell script to skip typing --app XXX on heroku commands when you have more than one enviroment like staging and production.
#!/bin/bash
set -eux
exec heroku "$@" --app "`basename $PWD`-staging"
#!/bin/bash
set -eux
exec heroku "$@" --app "`basename $PWD`-production"
@rafaelp
rafaelp / empreenda-1.txt
Created September 7, 2010 14:11
Notas sobre empreendedorismo
Vasculhando a papelada em casa encontrei este rascunho.
Acho que foi escrito na palestra pública pré-Empretec.
Não me preocupei em corrigir concordância, quis registrar como foi escrito na ocasião.
***
"Ideia de Negócio" é diferente de "Oportunidade de Negócio"
Empreender
@rafaelp
rafaelp / curriculo.doc
Created March 23, 2011 18:54
Currículo
CAVEIRA!
@rafaelp
rafaelp / deploy.rake
Created June 7, 2011 15:30
Rake task to deploy startupdev-ideas
namespace :heroku do
APP = 'startupdev-ideas'
def run(*cmd)
system(*cmd)
raise "Command #{cmd.inspect} failed!" unless $?.success?
end
def confirm(message)
print "\n#{message}\nAre you sure? [Yn] "
@rafaelp
rafaelp / gist:1013010
Created June 7, 2011 19:56
Stats do Startup DEV Ideas dia 1 às 5:00PM
+----------------------+-------+-------+---------+---------+-----+-------+
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
+----------------------+-------+-------+---------+---------+-----+-------+
| Controllers | 63 | 53 | 2 | 7 | 3 | 5 |
| Helpers | 7 | 7 | 0 | 1 | 0 | 5 |
| Models | 12 | 10 | 1 | 1 | 1 | 8 |
| Libraries | 40 | 36 | 0 | 1 | 0 | 34 |
| Model specs | 33 | 27 | 0 | 1 | 0 | 25 |
| View specs | 0 | 0 | 0 | 0 | 0 | 0 |
| Controller specs | 148 | 121 | 0 | 1 | 0 | 119 |
@rafaelp
rafaelp / notification_spec.rb
Created June 8, 2011 13:32
Exemplo de como testar Mailers com RSpec
require "spec_helper"
describe Notification do
describe "idea created" do
before(:each) do
@idea = Idea.new({
:author_name => 'Nome do Usuario',
:author_email => 'emaildousuario@example.com',
})
@idea.stub(:id).and_return(98765)
@rafaelp
rafaelp / idea.rb
Created June 8, 2011 14:22
How to avoid duplicate entries on self generated hash (edit_code in this example)
# model
before_create :set_edit_code
def self.friendly_token
ActiveSupport::SecureRandom.hex(10)
end
def self.edit_code_exists?(edit_code)
!where(:edit_code => edit_code).first.nil?
@rafaelp
rafaelp / gist:1080310
Created July 13, 2011 13:43
Chat Startup DEV #2 - Dia 1
[09:18am] adams.freenode.net: [freenode-info] if you're at a conference and other people are having trouble connecting, please mention it to staff: http://freenode.net/faq.shtml#gettinghelp
[09:27am] mergulhao joined the chat room.
[09:31am] dannluciano joined the chat room.
[09:31am] dannluciano: bom dia pessoal
[09:34am] willian joined the chat room.
[09:34am] willian: bom dia!
[09:35am] willian: sobre o q será o projeto hj?
[09:35am] ChanServ made this room no longer a secret.
[09:35am] ChanServ changed this room to require operator status to change the topic.
[09:35am] rafael_lima: Bom Dia!