All pages in tagged with #Javascript

NodeJS Package Conflicts on Ubuntu 14.04

Fixing issues with installing Cordova command-line tools on Ubuntu

Wednesday Jul 16, 2014 — 1 minute read — 157 words

If you’re developing with Cordova/PhoneGap/Ionic apps on the Ubuntu platform, chances are you’re using the cordova-cli package. For a while now, the nodejs and nodejs-legacy packages have collided around a singe man file. Unfortunately, the simple file collision can break the entire package manager and make it difficult to update anything. Add dkpg --force-overwrite Flag The solution is very simple. Just add the dkpg --force-overwrite flag to your apt-get commands. So this: sudo apt-get install cordova-cli becomes: sudo apt-get -o Dpkg::Options::="--force-overwrite" install cordova-cli Of course, you probably don’t want to type that all the time.

Read More

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