Skip to content

Instantly share code, notes, and snippets.

@dandirks
dandirks / gist:05a6e2d22d38349263ed
Created March 7, 2015 21:05
Straw Poll - New Poll API
Make a POST with something like the following body to "http://strawpoll.me/api/v2/polls"
{
"title": "Poll title",
"options":[
"Option #1",
"Option #2",
"Option #3"
],
"multi": true,
@dandirks
dandirks / math.coffee
Created April 22, 2012 01:45
CoffeeScript implementation of Python-like decorators
class window.EasyMath
# decorators
remember_last_result = (func) -> ->
@last_result = func.apply(@, arguments)
verify_number = (func) -> (args...) ->
if args.some((arg) -> typeof arg isnt 'number')
throw new Error('Numbers, idiot.')
func.apply(@, arguments)