Modern JavaScript: Arrow Functions

New with ES6, we have an additional way to write function expressions in our code – as arrow functions. This new syntax offers 3 main benefits:

  • They are much more concise than regular function expressions/definitions
  • They have implicit returns, which allow us to write single-line expressions (much like we can do with conditionals and the ternary operator)
  • The value of this is lexically bound, meaning that it is not re-bound when you use an arrow function inside of another function – which is very helpful for asynchronous callbacks

Continue reading “Modern JavaScript: Arrow Functions”

Vim Text Completion

I’ve been looking for a good autocomplete plugin for Vim for a while. It seems like the most popular option by far is YouCompleteMe (which I have been using for a while now). While I think YouCompleteMe is a good plugin, I also feel like it’s a bit heavy and seems to need a lot to setup and maintain. I always seem to have issues with the server going down.

Basically, I just wanted a lighter option.

Continue reading “Vim Text Completion”

Intro to the Web Storage API

What is Web Storage and when would you use it?

There are instances where storing data in a users browser can be really helpful. Up until somewhat recently, saving the state of the application locally in the browser via Cookies was the main way to achieve this. Cookies have limitations, however. For example, their max size (4093 bytes) and the fact that they have to me transmitted with every request.

Continue reading “Intro to the Web Storage API”

Ubuntu MATE on Raspberry Pi

I’ve been wanting to try out a Linux desktop for a while now. Mainly out of curiosity – I like to try new devices, operating systems, etc. I didn’t really want to invest in a computer just to try out a new OS, however. I had a couple older MacBooks lying around but I also had a Raspberry Pi 3 that I hadn’t quite decided what to do with. After poking around a bit on the internet, I found desktop variant Ubuntu MATE had been optimized for the use with the Raspberry Pi 2 & 3. The installation process looked pretty straightforward and I had an extra monitor, keyboard, and mouse so I figured I’d give it a try!

Continue reading “Ubuntu MATE on Raspberry Pi”

Yoda Conditional Statements

Here’s a little gem on conditional statements that I saw for the first time in the WordPress Coding Standards a few months ago. When writing out a conditional logic, it is recommended to place the variable on the right side of the comparison operator and the constants or literals on the left. Appropriately named “Yoda Conditions”, as the statement then reads backwards to how we would typically speak or think. I’ve never really thought about this before but it really is a handy little tip.

Continue reading “Yoda Conditional Statements”

Moving Local Files with Rsync

I am very obsessive about backing up my data. To preserve space on my MacBook Air’s drive, I store most of media files on a WD Passport external drive. Additionally I back that media up on a second (and oftentimes a third) desktop external drive. Sure, this is a little OCD but it’d be quite a shame to lose all of my files, should my first Passport drive fail me.

Continue reading “Moving Local Files with Rsync”