2012.10.29

Node.js Protip: Avoid Global Test Runners

Some of the most popular Node.js test frameworks advertise that they should be installed globally: Jasmine, Mocha, Buster.js, etc… I consider this an anti-pattern.

On this post I will try to explain why it’s an anti-pattern and show how to avoid global installs by using npm test instead.

Read more…


2011.12.27

FTP protip: move files instead of deleting

Lately I’ve been favoring SSH to upload/delete files from a server since it’s faster and I feel it gives me more control/power, but I still use a regular FTP client for most of my daily use (since I don’t have SSH access to all servers), this is just a very basic tip that some people may not be aware of and that can boost productivity and reduce downtime during updates.

The Workflow

  1. Upload new files to a _swap directory.
  2. Move current files to a _backup directory.
  3. Move new files from _swap to the parent directory.
  4. Test live files.
  5. Delete files inside the _backup directory.
  6. Win one free internet.

Why?

The main reason is because moving files on FTP is way faster than deleting them, specially if you are moving the files to a parent directory, it can reduce the downtime from a couple minutes to a few seconds depending on how many files you are updating.

Another reason is that you will have a backup of the current files on the server and you can easily revert the changes in case anything goes wrong. - You should also keep all source files on a version control system and make updates when the site has as few users as possible (usually from 9pm to 9am) to reduce the chance of ruining everything…

That’s it!