Instantly share code, notes, and snippets.

View .gitconfig
[alias]
current-branch = rev-parse --abbrev-ref HEAD
latestbranches = for-each-ref --count=15 --sort=-committerdate --format='%(committerdate:relative) %(refname:short)'
latestnonmasterbranch = !git for-each-ref --count=15 --sort=-committerdate --format='%(refname:short)' | grep -Ev 'origin|stash|master' | grep -v `git current-branch` | head -n 1
gotolast = !git co `git latestnonmasterbranch`
View keybase.md

Keybase proof

I hereby claim:

  • I am gaizka on github.
  • I am gaizka (https://keybase.io/gaizka) on keybase.
  • I have a public key whose fingerprint is 5DC0 406F 7764 D129 911A A4B1 E87C A4B8 A25D 3E1C

To claim this, I am signing this object:

View null_param_patch_for_rails_2_series.rb
# Adapted patch for CVE-2012-2660 rails vulnerability to Rails 2 versions
# https://groups.google.com/group/rubyonrails-security/browse_thread/thread/f1203e3376acec0f
#
# 1- Drop it at your_app/config/initializers/
# 2- Remember to pass your tests/specs
# 3- Profit!
module ActionController
class Request < Rack::Request
alias_method :normalize_parameters_with_null_vulnerability, :normalize_parameters
View capybara_nokogiri_xml_declaration_problem.rb
# coding: utf-8
require 'capybara'
require 'capybara/rspec'
require 'sinatra'
class TestApp < Sinatra::Base
set :root, File.dirname(__FILE__)
set :static, true
get '/' do
View Rakefile
# Minimiza todos los .js, .css que cuelgan de /private/{stylesheets,javascripts}/**/ y
# los deja en /public/{stylesheets,javascripts}/**/file.min.{css,js}
task :default => [:compile_js, :compile_css]
# Dependencias: Los ficheros destino
task :compile_js => FileList["private/**/*.js"].pathmap("%{^private,public}X.min.js")
task :compile_css => FileList["private/**/*.css"].pathmap("%{^private,public}X.min.css")
[:js, :css].each do |type|
# Cada fichero destino depende del "fuente" original
View Rakefile
ask :default do
system("spec --color -f specdoc user_spec.rb")
end