Skip to content

Instantly share code, notes, and snippets.

View bblimke's full-sized avatar

Bartosz Blimke bblimke

View GitHub Profile
@bblimke
bblimke / football_player.rb
Created September 5, 2011 10:30
Football Player
class FootballPlayer < Person
def kick_ball(ball)
# kicking ball logic
end
def run
# running logic
end
end
@bblimke
bblimke / dci_and_inheritance_example.rb
Created September 5, 2011 10:28
DCI and Inheritance
class Vehicle
attr_reader: speed
end
class Ship < Vehicle
attr_accessor: anchor
end
class Airplane < Vehicle
attr_accessor :wings
@bblimke
bblimke / dci_in_ruby_example.rb
Created September 5, 2011 10:00
DCI in Ruby
class Person
attr_reader :name
def initialize(name)
@name = name
end
end
person = Person.new("Trygve Reenskaug")
#!/usr/bin/env ruby
# O(nlogn) solution for the problem from the Coding Dojo at RailsCamp UK 2009
# Author: Bartosz Blimke
#Binary search in an array. I was too lazy so I adopted code from http://0xcc.net/ruby-bsearch/
class Array
def bsearch_upper_boundary (range = 0 ... self.length, &block)
lower = range.first() -1