Skip to content

Instantly share code, notes, and snippets.

module ShowMyMethods
def self.included(base)
puts (base.instance_methods - Object.instance_methods).sort
end
end
class IncludeFirst
include ShowMyMethods
def it_wont_be_shown; end
json.set! :files do
json.array! [@car_photo] do |photo|
json.id car_photo.id
json.url car_photo.car_photo.url(:thumb)
end
end
@arnvald
arnvald / moeny_changer.rb
Created December 9, 2012 16:44
money changer
require 'rspec'
class MoneyChanger
def initialize(notes=[200,100,50,20,10,5,2,1])
@notes = notes.uniq.sort.reverse
end
def change(amount)
possible_notes = @notes.select {|n| n <= amount}
@arnvald
arnvald / gist:4189376
Created December 2, 2012 15:42
Roman <> Arabic converter
roman = %w(M CM D CD C XC L XL X IX V IV I)
arabic = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]
@roman_arabic = Hash[*roman.zip(arabic).flatten]
def arabic2roman(arabic)
roman = ""
@roman_arabic.each do |symbol,value|
while arabic/value > 0
roman << symbol
arabic -= value
@arnvald
arnvald / wybuch.md
Created November 13, 2012 20:28
Wędrowniczy Wybuch

Gra na biwak "Wędrowniczy Wybuch"

Spis treści:

  1. Czas i miejsce
  2. Uczestnicy
  3. O Wybuchu
  4. Koncepcja gry
  5. TODO