Skip to content

Instantly share code, notes, and snippets.

@liaody
liaody / coffeescript_gotcha.md
Created January 12, 2012 01:56
Coffeescript gotchas when migrating from javascript

Here are some of the "gotchas" I've encountered when I converted all the javascript code into coffeescript. (BTW, this is gathered while coding for YourMechanic.com, a very cool mobile auto repair service.)

Disclaimer: Coffeescript is a great productivity booster for me personally. Even with all the things outlined below, it is still way better than javascript. None of these should discourage you from jumping into it right away.

Major gotchas

(Things that generate wrong code silently)

@blendmaster
blendmaster / gist:1897787
Created February 24, 2012 04:41
.hack assembler main logic in coco
code = input
.replace /\/\/.*/gm '' # remove comments
.trim!
.split /\s+/ # turn into lines
.filter (it, i) -> # build symbol table and remove labels
if it.match /\(([A-Za-z\._$:][\w\.$:]*)\)$/ # that[1] is the first capturing group
symbols[that[1]] = i - len++ # len++ adjusts the symbol's line number to the filtered array
return false
true # keep actual instructions
.map -> # parse instructions