Skip to content

Instantly share code, notes, and snippets.

View oriolgual's full-sized avatar

Oriol Gual oriolgual

View GitHub Profile
describe Woman do
its(:mood) { should == [':)', ':(', ':***', ':|', ':__(', ':__)', ':/', ':-)', ':*', ':@'].choice }
end
@oriolgual
oriolgual / gist:475677
Created July 14, 2010 16:57
In Radiant, group children in N slices
<r:children:slice slices="2">
<ul>
<r:each>
<li><r:title /></li>
</r:each>
</ul>
</r:children:slice>
@oriolgual
oriolgual / devise.ca.yml
Created September 21, 2010 19:39
I18n Catalan translation for Devise (http://github.com/plataformatec/devise)
ca:
errors:
messages:
not_found: "no s'ha trobat"
already_confirmed: "ja està confirmat"
not_locked: "no està bloquejat"
devise:
sessions:
link: 'Iniciar sessió'
@oriolgual
oriolgual / numlock.vim
Created September 22, 2010 20:32
Map your number to their correspondeing Shift+Number. Feel free to add more layouts
" Add it to your local vimrc
" Toggle it with Shift+n
let g:numberlock = 0
" Tried with inoremap 1 <S-1> but it wasn't working, so we'll have to set different layouts
" Anyone knows how to fix it?
let g:numberlock_layout = 'us'
nnoremap <silent><F4> :call NumberLock()<CR>
function! NumberLock()
# coding: utf-8
require 'rubygems'
require 'nokogiri'
require 'open-uri'
require 'cgi'
class Goear
def self.find(song)
puts "Searching for #{song}"
url = "http://www.goear.com/search.php?q=#{CGI.escape(song)}"
@oriolgual
oriolgual / Github https redirect
Created November 3, 2010 10:46
Redirection fail
http://wiki.github.com/aslakhellesoy/cucumber/
GET /aslakhellesoy/cucumber/ HTTP/1.1
Host: wiki.github.com
HTTP/1.1 302 Found
Server: nginx/0.7.67
Date: Wed, 03 Nov 2010 10:45:11 GMT
Content-Type: text/html; charset=utf-8
convert file.jpg -format %c -colors 8 -depth 24 histogram:info:- | sort -r -k 1
@oriolgual
oriolgual / helper_with_class.feature
Created November 17, 2010 14:00
rspec failing feature when a helper has a class inside the module
Scenario: failing test when a helper has a class inside a module
Given a file named "spec/helpers/with_class_helper_spec.rb" with:
"""
require "spec_helper"
describe WithClassHelper do
describe FooClass do
it 'works' do
helper.works.should be_true
end
Failure/Error: Unable to find matching line from backtrace
wrong argument type Class (expected Module)
# /Users/oriol/Code/rspec-dev/repos/rspec-rails/vendor/rails/actionpack/lib/abstract_controller/helpers.rb:123:in `include'
# /Users/oriol/Code/rspec-dev/repos/rspec-rails/vendor/rails/actionpack/lib/abstract_controller/helpers.rb:123:in `block in add_template_helper'
# /Users/oriol/Code/rspec-dev/repos/rspec-rails/vendor/rails/actionpack/lib/abstract_controller/helpers.rb:123:in `module_eval'
# /Users/oriol/Code/rspec-dev/repos/rspec-rails/vendor/rails/actionpack/lib/abstract_controller/helpers.rb:123:in `add_template_helper'
# /Users/oriol/Code/rspec-dev/repos/rspec-rails/vendor/rails/actionpack/lib/abstract_controller/helpers.rb:98:in `block in helper'
# /Users/oriol/Code/rspec-dev/repos/rspec-rails/vendor/rails/actionpack/lib/abstract_controller/helpers.rb:97:in `each'
# /Users/oriol/Code/rspec-dev/repos/rspec-rails/vendor/rails/actionpack/lib/abstract_controller/helpers.rb:97:in `helper'
# /Users/oriol/
@oriolgual
oriolgual / Ruby 1.9.2 can't add :(
Created December 13, 2010 11:37
adding_floats.rb
ruby-1.9.2-p0 > 2.10 + 0.24
=> 2.34
ruby-1.9.2-p0 > 2.11 + 0.24
=> 2.3499999999999996 # FFFFFUUUUUU-
ruby-1.8.7-p302 > 2.10 + 0.24
=> 2.34
ruby-1.8.7-p302 > 2.11 + 0.24
=> 2.35 # Better than expected :)