5 comments

[ 2.8 ms ] story [ 28.0 ms ] thread
in 1:

  'Content-Type': 'text/pain'
Should read 'text/plain'

in 2:

  spawn('tail' , ['-f', '/var/log/system.log']) 
I prefer to write

  spawn 'tail', ['-f', '/var/log/system.log']
---

  res.write(data)
Why not:

  res.write data
Applies to all calls.

---

  spawn= require('child_process').spawn
This is better written as:

  {spawn} = require 'child_process'
In 5:

  conn.end() if line == 'quit' 
Better (or more idiomatic):

  conn.end() if line is 'quit'
In 7:

  if !username
Perhaps more idiomatic:

  if not username
In 9:

  app.set 'view options', {layout: true}
I think this is cleaner, but it is mostly a preference:

  app.set 'view options', layout: true
Especially because in 10 you do:

  res.render 'products/show', locals: product: product
Where it WOULD make sense to use curly braces, for the sake of clarity:

  res.render 'products/show', locals: { product : product }
In 13:

  photos.list (err, photo_list) -> 
Just to be consistent I would use CamelCase for arguments as well.

In 14:

  console.log('%s %s', req.method, req.url)
What's up with this? Why not:

  console.log "#{req.method} #{req.url}"
In 15:

  module.exports.generate
You're fine using here:

  exports.generate
---------------------------------

Normally I consider it a dickmove to correct people in public, but in this case it's the right thing to do because a lot of folks inexperienced with CoffeeScript will read your examples.

Hello. I fixed the typo. Thanks. I really didn't expect that this would be posted on HN. I will try to update / fix the examples.
Great work though, I learned a couple of things from you too!