JavaScript Tutorials
Adding ESLint with gulp.js
I've noticed that I am a loose coder on my personal projects but want some level of decorum on Mozilla and other open source projects. The more developers you have contributing to a project, the tighter the ship you must keep. The easiest way to do that is...
JavaScript Promise API
While synchronous code is easier to follow and debug, async is generally better for performance and flexibility. Why "hold up the show" when you can trigger numerous requests at once and then handle them when each is ready? Promises are becoming a big part of the JavaScript world...
Use Promises Instead of Callbacks with promisify-node
One of the reasons we love promises so much is because they allows us to avoid the infamous callback hell that we've all experienced in these early days of Node.js. When I see an API that doesn't use the promise pattern, I get annoyed. Luckily I've found promisify-node, a...
Catching Fatal Errors with Node.js child_process
I'm relatively new to hardcore Node.js hacking so I'm seeing all sorts of lovely new errors that I have no clue how to solve when I initially see them. To this point I've managed to keep a smile on my face while trying to fix these...
Colorful Node.js Message Logging with Chalk
As you work more and more with Node.js, you start to see the value of good logging, especially to the console. The problem you run into, however, is that constantly adding logged messages means that the most important messages can get lost in the shuffle. Info messages should...
Detecting Online Status with JavaScript
It seems like there's been a huge push in the past year or two to make offline browsing an enjoyable experience with the web; a large part of that push probably being HTML5 mobile apps, or just web apps in general. Of course it would be helpful...
Detect Function Argument Names with JavaScript
I was recently looking over the promisify-node code to see how the author was able to convert basic functions and objects to a promised-based API. I quickly realized that they were reading function signatures to look for common callback argument names like
callback
andcb
.FileReader API
As broadband speed continues to get faster, the web continues to be more media-centric. Sometimes that can be good (Netflix, other streaming services), sometimes that can be bad (wanting to read a news article but it has an accompanying useless video with it). And every social service does...
Focused Image Cropping with smartcrop.js
Images tend to make any page more engaging, especially when done right. The problem is that automating image creation and sizing can be a very difficult task, especially when the image is uploaded by a user -- who knows what format, size, and resolution the image will...
Convert SVG to PNG
Earlier this year I became obsessed with different types of media (images, audio, video) and how to convert and merge one format to/with another. Half of that obsessions is due to fascination in how it's done, the other half is love of performance. A few of...