Skip to content

Instantly share code, notes, and snippets.

@juanjo
juanjo / gist:789661
Created January 21, 2011 13:21
Create new class with a block
def create_class(class_name, superclass, &block)
klass = Class.new superclass, &block
Object.const_set class_name, klass
end
@juanjo
juanjo / git_tips.md
Created July 1, 2011 14:17 — forked from fguillen/git_tips.md
Git Tips

(Several of these git examples have been extracted from the book 'Pragmatic guide to GIT' of Travis Swicegood )

Git tips

Global git user

git config --global user.name "Fernando Guillen"
git config --global user.email "fguillen.mail+spam@gmail.com"

Repository git user

cd /develop/myrepo

@juanjo
juanjo / change.rb
Created December 10, 2012 07:40
Quiz - Money Change
#!/usr/bin/ruby
@result = []
def make_change(amount, coins)
if (selected_coin = choose_coin(amount, coins.sort!.reverse!)) && amount > 0
@result << selected_coin && make_change(amount = amount - selected_coin, coins)
end
end
@juanjo
juanjo / countries.md
Created December 20, 2022 22:50 — forked from richjenks/countries.md
ISO 3166 countries by region — AMER, EMEA & APAC
Country ISO 3166 Region
Afghanistan AF EMEA
Åland Islands AX EMEA
Albania AL EMEA
Algeria DZ EMEA
American Samoa AS APAC
Andorra AD EMEA
Angola AO EMEA
Anguilla AI AMER