Skip to content

Instantly share code, notes, and snippets.

View kastner's full-sized avatar
🕳️
actively choosing...

Erik Kastner kastner

🕳️
actively choosing...
View GitHub Profile
@kastner
kastner / boilerplate.rb
Created August 7, 2011 18:48 — forked from caseybecking/gist:1130632
deployinator multiple deployments
module Deployinator
module Stacks
module Boilerplate
def boilerplate_production_version
# %x{curl http://my-app.com/version.txt}
"cf44aab-20110729-230910-UTC"
end
def boilerplate_head_build
# the build version you're about to push
#
# Ideas stolen from lograge and brought to Rails 2.3
# https://github.com/mattmatt/lograge/blob/master/lib/lograge/log_subscriber.rb
#
module ImprovedControllerLogging
def self.included(base)
base.alias_method_chain :log_processing, :fixup
base.inject_alias_method_chain :perform_action,
:perform_action_with_benchmark,
@kastner
kastner / README.md
Last active December 15, 2015 11:19 — forked from mbostock/.block

Copy and paste the swift code below into a playground to experiment.

This is a very close emulation of Functor and Monad typeclasses in swift. However, it is very fragile (i.e. easy to crash the compiler).

For example, instance methods of fmap will run fine, but attempting to use a globally defined fmap that acts on Functor types will cause a crash. Similarly for bind. Unfortunately this means we cannot define the nice infix operator versions of these functions.