Skip to content

Instantly share code, notes, and snippets.

View fabianoleittes's full-sized avatar
🌍
Working from home

Fabiano Leite fabianoleittes

🌍
Working from home
View GitHub Profile
@fabianoleittes
fabianoleittes / seed-mongodb
Created July 28, 2011 21:56
population seed
s = State.create([{ abbreviation: 'SP', name: 'São Paulo'},
{ s.cities.create( name: 'Adamantina' )},
{ s.cities.create( name: 'Adolfo' )},
{ s.cities.create( name: 'Aguaí' )},
{ s.cities.create( name: 'Águas da Prata' )},
{ s.cities.create( name: 'Águas de Lindóia' )},
{ s.cities.create( name: 'Águas de Santa Bárbara' )},
{ s.cities.create( name: 'Águas de São Pedro' )},
{ s.cities.create( name: 'Agudos' )},
{ s.cities.create( name: 'Alambari' )},
@fabianoleittes
fabianoleittes / create-post
Created August 5, 2011 22:48
create post and comment
p = Post.create(title: "test ", comment: Comment.new(name: "fabiano leite"))
@fabianoleittes
fabianoleittes / Action Mailer
Created January 24, 2012 14:07 — forked from fxn/Action Mailer
Ruby on Rails v3.2.0 CHANGELOGs
## Rails 3.2.0 (January 20, 2012) ##
* Upgrade mail version to 2.4.0 *ML*
* Remove Old ActionMailer API *Josh Kalderimis*
"pt-BR":
errors:
messages:
not_found: "não encontrado"
already_confirmed: "já foi confirmado"
not_locked: "não foi bloqueado"
not_saved:
one: '1 erro impediu que %{model} fosse gravado:'
other: '%{count} erros impediram que %{model} fosse gravado:'
require 'capistrano/ext/multistage'
set :application, "minha_app"
set :repository, "meu_repositorio"
set :scm, :git
set :use_sudo, false
set :ssh_options, { :forward_agent => true }
@fabianoleittes
fabianoleittes / gist:1772232
Created February 8, 2012 19:05
profile the best
export PS1='\[\033[38m\]\u\[\033[32m\] \w \[\033[1;33m\]`~/.rvm/bin/rvm-prompt i v
`\[\033[0;31m\] `git branch 2> /dev/null | grep -e ^* | sed -E s/^\\\\\*\ \(.+\)$/\(\\\\\1\)\ /
`\[\033[37m\]$\[\033[00m\] '
{
"auto_completecommiton_tab": true,
"bold_folder_labels": true,
"color_scheme": "Packages/User/colour-schemes/Monokai Soda.tmTheme",
"draw_minimap_border": true,
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"file_exclude_patterns":
[
"*.log",
@fabianoleittes
fabianoleittes / st_cheat.txt
Created April 16, 2012 14:21 — forked from bjhess/st_cheat.txt
Sublime Text Cheatsheet
Navigation:
cmd-p Goto Anything ('@' for functions, ':' for line number)
cmd-r Function finder
ctl-g Goto line number
cmd-sft-p Command palette
cmd-sft-f Find in Files
cmd-opt-r Toggle regex when finding
cmd-opt-# Columns
ctr-# Switch columns
@fabianoleittes
fabianoleittes / gist:3605293
Created September 2, 2012 22:41 — forked from lucasfais/gist:1207002
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
@fabianoleittes
fabianoleittes / authenticator.rb
Created October 11, 2012 22:36
Simple Authentication
class Authenticator
def self.authenticate(email, password, encryption_engine = BcryptAdapter)
user = User.find_by_email(email)
return unless user
actual_hash = encryption_engine.encryptor(password, user.password_salt)
return user if user.password_hash == actual_hash