Skip to content

Instantly share code, notes, and snippets.

View wesvetter's full-sized avatar
coffee plz

Wes Vetter wesvetter

coffee plz
View GitHub Profile
@wesvetter
wesvetter / common.coffee
Created February 5, 2019 17:27 — forked from carlsmith/common.coffee
A small collection of generic CoffeeScript helper functions.
# shorthand wrapper for `console.log`
put = (args...) -> console.log args...
# initialise undefined vars: `[a, b, c] = init 3`
init = (amount) -> undefined for n in [1..amount]
# decorator for defining constructors (see example.coffee)
factory = (mutator) -> (args...) ->
mutator (self = Object.create null), args...
return self