Skip to content

Instantly share code, notes, and snippets.

View pdabrowski6's full-sized avatar
✍️
The hybrid of writer and developer

Paweł Dąbrowski pdabrowski6

✍️
The hybrid of writer and developer
View GitHub Profile
def something
return false
end
puts "Kupuje" if cena < 50
@pdabrowski6
pdabrowski6 / gist:1309986
Created October 24, 2011 20:02
fill foo(x)
require 'test/unit'
def foo(x)
if x.kind_of?(Fixnum)
x = x * -1
else
x = x.to_i
x = x * 1
x = x.to_f
end
class Sort
attr_reader :my_array
def initialize(my_array)
@my_array = my_array
end
def switch_array(element, element2)
@my_array[element], @my_array[element2] = @my_array[element2], @my_array[element]
end
def quicksort(p, r)
if p < r then
class NumberService
def number
12
end
end
describe NumberService do
describe '#number' do
it 'returns 12' do
expect(NumberService.new.number).to eq(12)
end
it 'does not return 10' do
expect(NumberService.new.number).not_to eq(10)
end
end
class Server
attr_reader :env, :domain
end
class Config
def server
@server ||= Server.new
end
end
config = Config.new
config.server.env = 'production'
config.server.domain = 'domain.com'
class Server
attr_accessor :env, :domain
end
class Config
def initialize(&block)
instance_eval &block
end
def server
class Describe
attr_reader :context_name
def initialize(context_name, &block)
@context_name = context_name
instance_eval &block
end
end