Skip to content

Instantly share code, notes, and snippets.

require 'validate_entry_state'
describe Entry_State do
it "should be invalid without a number" do
entry_state = Entry_State.new(nil, "PR")
entry_state.should_not be_valid
end
it "should be invalid without a state" do
entry_state = Entry_State.new("123456789", nil)
@zegomesjf
zegomesjf / .tmux.conf
Created May 9, 2012 17:31
configuração do tmux
set -g default-terminal "screen-256color"
set -g mode-mouse on
@zegomesjf
zegomesjf / remove_dups.rb
Created June 18, 2012 16:18 — forked from urubatan/remove_dups.rb
Ruby script to remove duplicated files, I created it when migrating my pictures collection from iPhoto to picasa, and merged some independent collections, it created a real mess, and the result of this big mess is this gist.
require 'digest/sha1'
require 'fileutils'
directories = [
"SOURCE DIR 1",
"SOURCE DIR 2"
]
files = {}
directories.each do |dir_name|
puts "Scanning Directory: #{dir_name} "
Dir.glob("#{dir_name}/**/*.*") do |file_name|
@zegomesjf
zegomesjf / gist:3425179
Created August 22, 2012 12:37
Object#presence

object.presence is equivalent to object.present? ? object : nil

Use

region = params[:state].presence || params[:country].presence || 'US'

instead

require "#{Rails.root}/lib/development_mail_interceptor"
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:user_name => 'zegomesjf',
:password => 'euamoocomogo',
:authentication => 'plain',
:enable_starttls_auto => true
}

Atualizando o branch de trabalho

Supondo que se está no branch de trabalho chamado work

git checkout master

git pull origin master

git checkout work

cat ~/.gitconfig
[user]
name = José Gomes Júnior
email = zegomesjf@gmail.com
[core]
excludesfile = ~/.gitignore
[color]
diff = auto
status = auto
branch = auto
;var FooBar = (function($, window, document, undefined) {
'use strict';
/**
* Constructor method
*
* @author Gustavo Franco
* @since 2013-06-27
*/
function FooBar() {
# www.guepardolabs.com -> guepardolabs.com
# www.guepardolabs.com.br -> guepardolabs.com
# www.guepardolabs.net -> guepardolabs.com
# guepardolabs.com.br -> guepardolabs.com
# guepardolabs.net -> guepardolabs.com
require 'rack-rewrite'
use Rack::Rewrite do
r301 %r{.*}, 'http://guepardolabs.com$&', :if => Proc.new {|rack_env|
rack_env['SERVER_NAME'] != 'guepardolabs.com'
}
@zegomesjf
zegomesjf / gist:9805170
Created March 27, 2014 11:07
Freshbooks - Contractor data
ap c.contractor.list.first
[
[0] "contractors",
[1] {
"contractor" => [
[ 0] {
"contractor_id" => "xxxx",
"name" => "José Gomes Júnior",
"email" => "xxxx@gmail.com",