Skip to content

Instantly share code, notes, and snippets.

Working from home

Jorge kalmbach

Working from home
View GitHub Profile

Keybase proof

I hereby claim:

  • I am kalmbach on github.
  • I am kalmbach ( on keybase.
  • I have a public key ASB3JdjSXH24vM0HNwGt8f2Y9S_2H-HjvDTLO3sKHyTnHQo

To claim this, I am signing this object:

kalmbach / flatten.rb
Created Feb 26, 2016
Flatten Exercise
View flatten.rb
# Ruby already has a 'flatten' method in the Array class
# [[1,2,[3]],4].flatten -> [1,2,3,4]
# I did my own implementation as an exercise
module Code
def ruby_flatten(ary)
ary.flatten if ary.respond_to? :flatten
kalmbach / gist:5385621
Last active Dec 16, 2015
Rack Middleware that implements Session Flash messages. (session values that will be available just for the request) Usage: use Rack::Session::Flash
View gist:5385621
module Rack
module Session
class Flash
def initialize(app)
@app = app
def call(env)!(env)
kalmbach / gist:4471560
Created Jan 7, 2013
Rake task sugar for Sequel Migrations (version, migrate, rollback, reset)
View gist:4471560
namespace :db do
require "sequel"
Sequel.extension :migration
DB = Sequel.connect(ENV['DATABASE_URL'])
desc "Prints current schema version"
task :version do
version = if DB.tables.include?(:schema_info)
end || 0
kalmbach / Date-extensions.rb
Created Oct 30, 2012
Extending Date Class. WeekDay and Next WeekDay methods.
View Date-extensions.rb
class Date
# Extend Date Class with some custom methods
# Returns the name of the week day.
# -> 'Monday'
def weekday