Skip to content

Instantly share code, notes, and snippets.

@slloyd
slloyd / derp.md
Created May 3, 2013 22:33
DERP.coffee
foo =
  a: 1
  b: 2
  c: 3

x = Object.keys foo

y = key for key, value of foo
@slloyd
slloyd / wtf.coffee
Last active December 24, 2015 13:09
LOLCOFFEESCRIPT
x = [1, 2, 3, 4]
alert(x.length - 1)
alert(x.length- 1)
alert(x.length-1)
alert(x.length -1)
@slloyd
slloyd / foo.coffee
Created February 14, 2014 18:38
yo.coffee
x = [ 'a', 'b', 'c', 'd', 'e', 'f']
len = x.length
y = x[1...(len-1)]
z = x[1..(len-1)]
@slloyd
slloyd / foo.coffee
Created February 14, 2014 21:58
How to write a function that might not return anything
foo = (a, b, plusOne = true) ->
out = a + b
out += 1 if plusOne
@slloyd
slloyd / coffeescript.md
Last active February 8, 2023 21:10
CoffeeScript: The Good Parts

CoffeeScript: The Good Parts

The End

@slloyd
slloyd / lolternaries.md
Last active August 29, 2015 14:14
LOLTERNARIES

Act One

coffeescript:

a = if x then y else z

javascript:

a = x ? y : z;