Skip to content

Instantly share code, notes, and snippets.

View StefanHoutzager's full-sized avatar

Stefan Houtzager StefanHoutzager

View GitHub Profile
@mpj
mpj / classless.md
Last active September 21, 2024 15:03

The future is here: Classless object-oriented programming in JavaScript.

Douglas Crockford, author of JavaScript: The Good parts, recently gave a talk called The Better Parts, where he demonstrates how he creates objects in JavaScript nowadays. He doesn't call his approach anything, but I will refer to it as Crockford Classless.

Crockford Classless is completely free of class, new, this, prototype and even Crockfords own invention Object.create.

I think it's really, really sleek, and this is what it looks like:

function dog(spec) {
@chrismccord
chrismccord / upgrade.md
Last active April 7, 2023 12:03
Phoenix 1.2.x to 1.3.0 Upgrade Instructions

If you want a run-down of the 1.3 changes and the design decisions behidn those changes, check out the LonestarElixir Phoenix 1.3 keynote: https://www.youtube.com/watch?v=tMO28ar0lW8

To use the new phx.new project generator, you can install the archive with the following command:

$ mix archive.install https://github.com/phoenixframework/archives/raw/master/phx_new.ez

Bump your phoenix dep

Phoenix v1.3.0 is a backwards compatible release with v1.2.x. To upgrade your existing 1.2.x project, simply bump your phoenix dependency in mix.exs:

@Qqwy
Qqwy / scream.ex
Last active July 19, 2017 03:15
How exclamation marks are supposed to be used in Elixir
defmodule Scream do
defmacro scream!(ast) do
{exclams, res} = count_exclams(ast, 0)
case exclams do
_ when exclams < 5 ->
quote do "You say: #{inspect(unquote(res))}." end
_ when exclams < 10 ->
quote do "You yell: #{inspect(unquote(res))}!" end
_ when exclams < 15 ->
quote do "You scream: #{inspect(unquote(res))}!!" end