Skip to content

Instantly share code, notes, and snippets.

View koudelka's full-sized avatar
💭
一所懸命働いているん

Michael Shapiro koudelka

💭
一所懸命働いているん
View GitHub Profile
@koudelka
koudelka / type_bully.exs
Created March 12, 2016 00:21
TypeBully is an (incomplete) toy module to force Elixir functions to respect their typespecs.
#
# TypeBully forces functions to respect their typespecs by rewriting the function clauses to include proper guards.
#
# For example, the Wimp module below: cry/3 has typespecs, but no enforcing guards, normally, calling cry/3 would
# always match the first function clause, but TypeBully forces it to select the correct one based on its typespec.
#
#
# Without TypeBully:
#
# iex(1)> Wimp.cry("whaa")
@koudelka
koudelka / gist:f4d07b9d998d723e55a0
Created June 6, 2014 20:52
Possible http status codes module for Elixir Phoenix Web Framework
#
# Would this be useful to Phoenix?
#
# In controllers, it'd be nice to be able to refer to status codes as atoms instead of integers.
#
defmodule Phoenix.Controller.StatusCodes do
@http_status_codes %{