Skip to content

Instantly share code, notes, and snippets.

@alyssais
Created January 10, 2016 21:50
Show Gist options
  • Save alyssais/6c0b96ba18f58f6e3377 to your computer and use it in GitHub Desktop.
Save alyssais/6c0b96ba18f58f6e3377 to your computer and use it in GitHub Desktop.

Often I find myself writing this and it always seemed annoyingly repetetive:

layout = ->
  # ...
  
layout()
window.addEventListener "resize", layout

But today I discovered I can do this:

do layout = ->
  # ...
  
window.addEventListener "resize", layout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment