Skip to content

Instantly share code, notes, and snippets.

View mergulhao's full-sized avatar

Sylvestre Mergulhão mergulhao

View GitHub Profile
module IncrementAndDecrement
def increment(&block)
matcher = change(&block).by(1)
RSpec::Matchers::AliasedMatcher.new(matcher, lambda do |desc|
desc.gsub("changed", "incremented").gsub("change", "increment")
end)
end
def decrement(&block)
matcher = change(&block).by(-1)
outdated_gems = `gem outdated`
regex = %r((?<gem>[\w-]+) \((?<old>[\d\.]+) < (?<new>[\d\.]+)\))
gemfile = File.read("./Gemfile")
outdated_gems.each_line do |line|
data = line.match(regex)
gemfile.gsub!(%r(gem '#{data[:gem]}',(\s+)'[^']+'), "gem '#{data[:gem]}',\\1'#{data[:new]}'")
end
module DelayedJob
module Matchers
def enqueue_delayed_job(handler)
DelayedJobMatcher.new handler
end
class DelayedJobMatcher
def initialize(handler)
@handler = handler
@attributes = {}
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@rafaelp
rafaelp / startupdev_heroku_bootstrapp.sh
Created November 15, 2011 13:57
Startup DEV - Heroku Bootstrapp
#!/bin/bash
heroku auth:login
heroku apps:create -s cedar $1
heroku sharing:add contato@mergulhao.info
heroku sharing:add ramonpage@gmail.com
heroku sharing:add rafael.lima@bielsystems.com.br
heroku addons:add shared-database:5mb
heroku addons:add loggly:mole
heroku addons:add pgbackups:auto-month
@rodrigotassinari
rodrigotassinari / gist:1078666
Created July 12, 2011 18:47 — forked from sagmor/gist:1041943
Patched Ruby 1.9.2 for faster load and GC
# Ruby 1.9 Fast require:
# https://gist.github.com/1008945
curl https://raw.github.com/gist/1008945/7532898172cd9f03b4c0d0db145bc2440dcbb2f6/load.patch > load.patch
# Ruby 1.9.2 GC Patch:
# https://gist.github.com/856296
curl https://raw.github.com/gist/856296/a19ac26fe7412ef398bd9f57e61f06fef1f186fe/patch-1.9.2-gc.patch > gc.patch
rvm install 1.9.2-p180 --patch load.patch,gc.patch -n loadgc
rm gc.patch load.patch
@nruth
nruth / cookie_steps.rb
Created July 21, 2010 17:16
Testing login "remember me" feature with Capybara (rack::test or selenium) - deleting the session cookie (only)