Skip to content

Instantly share code, notes, and snippets.

View dmitryrck's full-sized avatar

Dmitry L Rocha dmitryrck

View GitHub Profile
@turadg
turadg / subdomains.rb
Last active January 21, 2024 19:45 — forked from rtekie/subdomains.rb
Drop-in utility to test your app subdomains with Capybara, Rspec, and a Javascript driver (Poltergeist, Webkit, or Selenium)
# Support for Rspec / Capybara subdomain integration testing
# Make sure this file is required by spec_helper.rb
# (e.g. save as spec/support/subdomains.rb)
def switch_to_subdomain(subdomain)
# lvh.me always resolves to 127.0.0.1
hostname = subdomain ? "#{subdomain}.lvh.me" : "lvh.me"
Capybara.app_host = "http://#{hostname}"
end
@samflores
samflores / .vimrc
Created March 21, 2013 16:36
Esse é o meu arquivo .vimrc. Esse script ~/bin/background_color é um shell script que retorna light ou dark. Isso deveria setar o background do Vim, mas quando inicio o vim não tá fazendo efeito. O que eu acho curioso é que se, depois de aberto, eu executar source ~/.vimrc, funciona
let bg=system("~/bin/background_color")
set background="".bg
colorscheme solarized
@infoslack
infoslack / List links
Created November 14, 2012 00:20
List Links Example HTML5 and CSS3...
@sobrinho
sobrinho / factory_girl_cache.rb
Last active December 10, 2018 16:27
Object caching for factory girl
module FactoryGirl
module Strategy
class Cache
def association(runner)
runner.run(:cache)
end
def result(evaluation)
repository.read(evaluation) || repository.store(evaluation)
end
@isaacs
isaacs / .gitconfig
Created June 8, 2012 19:01
These are my shortcuts for git.
# A bunch of the stuff above relies on this, especially the aliases.
[user]
# you probably want to change this bit.
name = isaacs
email = [email protected]
signingkey = 0x6C481CF6
[alias]
ci = commit
st = status
br = branch
sudo ifconfig en1 ether `openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'`
// Here is a proposal for minimalist JavaScript classes, humbly offered.
// There are (at least) two different directions in which classes can be steered.
// If we go for a wholly new semantics and implementation, then fancier classical
// inheritance can be supported with parallel prototype chains for true inheritance
// of properties at both the class and instance level.
// If however, we keep current JavaScript prototype semantics, and add a form that
// can desugar to ES3, things must necessarily stay simpler. This is the direction
// I'm assuming here.
pt-BR:
errors:
messages:
expired: 'expirou, por favor solicite um novo'
not_found: 'não encontrado'
already_confirmed: 'já foi confirmado, por favor tente fazer login'
not_locked: 'não estava bloqueado'
not_saved:
one: "1 erro impediu que %{resource} fosse salvo:"
other: "%{count} erros impediram que %{resource} fosse salvo:"
@tinogomes
tinogomes / gist:1006296
Created June 3, 2011 13:03
.boolean? method for ruby objects
module RubyExt
module Boolean
module ClassMethods
def boolean?
["TrueClass", "FalseClass"].include?(self.name)
end
end
module InstanceMethods
def boolean?