HN user

arckiearc

11 karma
Posts1
Comments10
View on HN

Great tips. !! is a nice timesaver when you've forgotten to prepend sudo to a command:

  $ /etc/init.d/rabbitmq-server restart
  Failed, need root access
  $ sudo !!
  Success
cd - is also quite cool, it takes you to the previous working directory.
  $ pwd
  /some/really/long/path/goes/here
  $ cd /var/log/app
  Work in this directory for a while, then go to previous dir
  $ cd -
  $ pwd
  /some/really/long/path/goes/here

I went through the same process as you. I think it's okay not to have hard and fast rules for every acceptable situation to leave off parentheses, it's more a judgement call based on the readability of the statement.

`Require` and `console.log` are perfect examples where leaving off the parentheses helps with clarity, same with the call to `createServer`. In your example I'd even argue that you could do the same with `res.end` too.

I'm curious, would you prefer to write code like this over the explicit version?

  foo bar: 'baz', quux('onoz')
Or are you just concerned about inconsistencies?

I like not having to specify parentheses, but only do so when it's immediately obvious to a reader of the code what the result of the statement will be.

Once you get rolling with Chef or Puppet, updating your servers feels great - no need to manually fiddle with shell scripts, or wonder "have I installed that package on all my machines?"

Getting to that point can take quite a bit of effort though. In my most recent attempt to install a Chef server on a fresh Ubuntu box, I quit the installation halfway through as I realised I wanted to change some of the values I'd entered into the setup script. After re-running the script I encountered errors, and all my attempts at scrubbing the aborted installation failed. It was easier to just start with a fresh image. I had these sorts of experiences all the time when using Chef and Puppet, they were really frustrating to setup.

I felt more comfortable writing my scripts in Chef because it didn't limit my ability to use Ruby, and the more relaxed approach to handling dependencies suited me. Puppet was easier to setup, had better documentation, and behaved more reliably for me. Neither seems like a clear winner, but I haven't spent a lot of time with them in about a year now, so things may have changed!