I recently spent some time building a new WordPress theme and decided to leverage Grunt and Bower in the process. I’m sure there are already some awesome Yeoman generators out there, but I opted to create my own simple setup. I wanted to incorporate Bootstrap and FontAwesome, then add some simple Grunt tasks to compile, minify, etc.

I just published an in-depth tutorial that covers how to configure a complete server stack over on the Ghost Inspector blog. I had a great experience building out Ghost Inspector’s infrastructure and wanted to share some details about what can be accomplished nowadays for just $50/mo. It’s a thorough article and walks you through the configuration of the various servers you’ll be needing: web, app, api, database, load balancer, etc. Give it a look!

I’ve always liked the idea of being able to reuse Javascript code in both Node.js (on the backend) and the browser (on the frontend). I finally ran into a situation this weekend where it was practical to do this and I was surprised by just how easy it was to do. I thought I’d throw my solution into a post. The code below is written in CoffeeScript.

First, we create a class named "myClass" and add a method to it. Then, with a simple if statement, we can determine whether we’re running this code in Node.js or in the browser and export the class accordingly. Let’s assume we’re compiling this down into "my-class.js".

I recently setup a simple deployment process using Grunt, so I thought I’d share the details. I found a couple deployment-related Grunt plugins out there, but they didn’t really suit my needs. Instead, I opted to simply use the grunt-ssh plugin to connect to my server and run the necessary commands to update, build and restart my application. Let’s take a look at a simplified Gruntfile.coffee.

I’ve been doing a lot of backend development in Node.js recently. Node.js runs on a single threaded event loop and leverages asynchronous calls for doing various things, like I/O operations. While other languages will send a database query and wait there for the result to come back, Node.js will not. When you send a database query, Node.js will continue executing the code that comes after it, then jump back when the result is available.