Category Archives: Coding

Node.js the Right Way

Node.js The Right WayLooking to quickly get started with Node.js without learning bad habits? Node.js the Right Way is a short and concise—100 pages—book that you can easily read in an afternoon (maybe two if you’re following along with the examples), promising a focused, tutorial-based experience.

The book makes the assumption that you’re already somewhat familiar with programming and the JavaScript language in particular. Instead of wasting time with absolute basics, it dives right in to Node. The first two chapters explain what exactly Node is, and how the the event loop works. It covers the differences between synchronous and asynchronous tasks, illustrating the reason you want to avoid blocking I/O. The next two chapters deal with sockets, serializing data and message queues. Other sections deal with databases (using CouchDB as an example), unit tests, building and consuming RESTful APIs and single-page web apps.

If you work your way through the examples in the book, you’ll end up building a reasonably complex web app and batch-importing a bunch of data from Project Gutenberg.

Node.js the Right Way is the best introduction to Node that I’ve seen so far. It’s concise enough it won’t take up a lot of your time, covers things more thorougly than a 500-word blog post or hour-long screencast, and there’s no magic “just copy and paste this, I’m not going to bother explaining it.” You should come out of it knowing where to go to keep learning. It’s easy enough to think “I used Express for this, and Grunt for that. Maybe I should search for more information about those tools.”

Illustrating Keyboard Shortcuts with the <kbd> Tag and a Bit of CSS

The HTML spec has long had a (much underutilized) tag called kbd, which is intended to be used for marking up user input. For example, you could write something like this: The browser (by default) renders the kbd tags in a monotype font, just…

Finding a Website’s Favicon with Ruby

For a project I’ve been working on, I wanted to to have my Sidekiq worker (which is part of an RSS crawler) discover the favicon for a web site and cache it for later display. It was fun figuring out a way to do…

JavaScript is the Most Popular Language on GitHub, with Ruby Coming in Second

On a whim, I decided to browse through GitHub’s Explore section recently. I don’t know whether users go there often or not (I certainly don’t), but there are some intriguing statistics there that tell a thing or two about what’s popular and who’s using…

Custom JavaScript Twitter Widgets in an API 1.1 World

Continuing their gradual shutdown of old APIs (following the launch of version 1.1 of their API), Twitter recently pulled the plug on their old-style widgets and the unauthenticated search API. This means if you had a fancy custom-designed JavaScript widget to show off your…

Find the Number of Lines in a Git Repository

Want to figure out how many lines of code are in your Git repository? I’ve had an alias in my .bashrc file for ages that does just that. It uses git ls-files to generate a list of files, which it then passes it to…

Amazon Menu Triangle

How Amazon Solved the Dropdown Delay Problem

If you’ve ever made a dropdown menu, you’re probably familiar with the “hover delay problem,” where a user tries to diagonally move the mouse from a submenu trigger to the menu that pops out, which causes the menu to snap closed when it loses…

Method Chaining in PHP

Have you ever come across a PHP class that connects methods together in a single line to achieve some goal? (If you haven’t, Guzzle and SwiftMail are a couple of examples.) jQuery also operates in a similar manner, using the same principle. The technique…

Generating a Software License Key String with PHP

I was working on a project recently that required unique API keys to be generated for clients connecting to the server. For various reasons, I settled on the style of license key you commonly see for software packages. You know, the kind you always…

PHP: The Right Way

There’s a lot of outdated information on the Web that leads new PHP users astray, propagating bad practices and bad code. This must stop. PHP: The Right Way is an easy-to-read, quick reference for PHP best practices, accepted coding standards, and links to authoritative…

Page 1 of 14123456Last »