All pages in the Javascript category


Promise-based JS Script Loader

Using ES6 promises to build an ultra-small script loader

Monday Jul 14, 2014 — 2 minute read — 402 words

If you’re not familiar with JavaScript promises, you’ll definitely want to check out this article by Jake Archibald to see why there the coolest thing since sliced bread. We’re going to see how we can take advantage of promises to build a script loader in just a few lines of code. The Basic Syntax of Promises The result of any promise is accessed with the then() function. The first argument is the success callback, the second is the failure callback.

Read More


Transferrring Files to Remote Servers with GulpJS

A secure method to automate file uploads.

Sunday Jun 29, 2014 — 3 minute read — 578 words

On occasion, or perhaps even more frequently, you may want to use GulpJS in combination with a remote server. Watching local changes and uploading them is thankfully very easy. We’re going to focus on the most secure option - using SSH over FTP. Setup Install gulp-sftp locally. It’s as simple as: npm install --save-dev gulp-sftp After that, you can load it with a simple: var sftp = require("gulp-sftp"); The Task Here’s a sample Gulp task to get us started.

Read More