Chovy's Blog

Web Development with Node.js, Javascript, and HTML5


Fibonacci generator using EcmaScript 6 (es6)

I took my first stab at the --harmony flag on node 11 to play with generators.

Thanks to this video:

Here’s a simple example of using an ES6 generator to generate the first 10 numbers in the Fibonnaci sequence:

What wasn’t clear to me before watching this video by Netflix UI Architect Jafar Husain was that a generator returns an “iterator”….and on that iterator you call “.next()” to get the next yield. A generator can yield infinite times, so in this case we loop over the call 10 times to get the first 10 numbers.


A gentle introduction to bitcoin

I recently (2 years ago) discovered Bitcoin and started researching and following it back then. The price was about $14 when I seriously considered buying some. The technology posed a bit of a hurdle in the learning curve, so here are a few thoughts on how to go about buying bitcoins, managing wallets, and spending your BTC.

First, I live in the USA. So transferring money from a bank account is pretty well supported on popular money sites (PayPal, Dwolla, Coinbase).

If you live outside the US, try a site like which has many ways to buy and sell Bitcoins person-to-person.


Example of $resource in Angular.js with update and save using a resolver.

I had some issues trying to understand how to use a resolver (for edit view) and $resource to do both a POST (save) and a PUT (update) method call to an API.

Here is an example plurk:

Here is the route, the edit path uses a resolver to pass ‘thing’ object/promise back to the edit.html view before the page loads — this is to prepopulate the form:


Setup email forwarding with Postfix on Debian

As you are probably aware, setting up a fully functional email server is a daunting task to say the least.

On my dedicated server I wanted to have simple email forwarding for email aliases on my domain. For example would forward to my Gmail account. I didn’t want to jump through the hoops to setup a fully functional SMTP/Inbox/Imap email server when all I needed was a forwarding address at my custom domain.

Here are the steps, which takes around 10 minutes.

More info can be found here:


Make samba create files with usable group permissions

I am using Samba as my file server at home and connecting to it from two different users on their own macbook laptops. The Debian server has a share directory in /var/share that either myself or any other user on the system can connect to and create files or directories in. We all want to be able to edit each others files in addition to adding or removing directories and files as well, regardless of who created or owns them.

First, I created a directory in /var/share that is owned by one user, with group of “users”. All users with access to this share are members of the ‘users’ group on the file server.