fix file permissions

Signed-off-by: Christopher Hall <hsw@ms2.hinet.net>
fix whitespaces and a few syntax errors

also quote 'default' in switch since this is a reserved word

Signed-off-by: Christopher Hall <hsw@ms2.hinet.net>
initial port to CoffeeScript

Signed-off-by: Christopher Hall <hsw@ms2.hinet.net>