Skip to content

Instantly share code, notes, and snippets.

@gaizka
gaizka / .gitconfig
Last active October 5, 2016 16:52
A couple of git aliases
[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`

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:

@gaizka
gaizka / null_param_patch_for_rails_2_series.rb
Created June 5, 2012 16:57
Patch for Rails null param vulnerability (CVE-2012-2660) ported to Rails 2.3.x versions
# 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
@gaizka
gaizka / capybara_nokogiri_xml_declaration_problem.rb
Created January 8, 2012 12:22
Maybe Capybara <-> Nokogiri bug, inserting extra xml declaration
# coding: utf-8
require 'capybara'
require 'capybara/rspec'
require 'sinatra'
class TestApp < Sinatra::Base
set :root, File.dirname(__FILE__)
set :static, true
get '/' do
@gaizka
gaizka / Rakefile
Created November 18, 2011 02:54
Rake task to minimize js, css and manipulate its name and path
# 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
ask :default do
system("spec --color -f specdoc user_spec.rb")
end