Skip to content

Instantly share code, notes, and snippets.

View shostakovich's full-sized avatar
🚩
Focusing

Robert Curth shostakovich

🚩
Focusing
View GitHub Profile
@shostakovich
shostakovich / prime_factors_2_spec.rb
Created July 3, 2012 19:58
PrimeFactors Kata Second iteration
class PrimeFactors
def self.generate(number)
if number == 1
[]
elsif number <= 3
[number]
else
result = []
Array((2..number / 2)).each do |i|
while(number % i).zero? do
@shostakovich
shostakovich / fizz_buzz_4_spec.rb
Created July 2, 2012 16:25
FizzBuzz Kata 4th iteration
class Game
def self.play
(1..100).map { |n| Kid.answer_to(n) }
end
class Kid
def self.answer_to(number)
if (number % 15).zero?
"FizzBuzz"
elsif (number % 3).zero?
@shostakovich
shostakovich / symfony_watchr.rb
Created February 13, 2011 13:48
A simple watch script for symfony
def run_unit_test(file)
system("php5 symfony test:unit #{file}")
end
def run_functional_test(app, controller)
system("php5 symfony test:functional #{app} #{controller}Actions")
end
def build_schema
system("php5 symfony doctrine:build --all-classes")