Warning: include(/nfs/c07/h01/mnt/108745/domains/chovy.com/html/wp-content/plugins/wp-super-cache/wp-cache-base.php) [function.include]: failed to open stream: No such file or directory in /nfs/c07/h04/mnt/108745/domains/chovy.com/html/wp-content/plugins/wp-super-cache/wp-cache.php on line 65

Warning: include_once(/nfs/c07/h01/mnt/108745/domains/chovy.com/html/wp-content/plugins/wp-super-cache/ossdl-cdn.php) [function.include-once]: failed to open stream: No such file or directory in /nfs/c07/h04/mnt/108745/domains/chovy.com/html/wp-content/plugins/wp-super-cache/wp-cache.php on line 82

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:

fibonnaci

JavaScript

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

#!/usr/bin/env node--harmony

'use strict';

varfib=getFibonacci();

init();

function*getFibonacci(){

let val1=0,val2=1,swap;

yield val1;

yield val2;

while(true){

swap=val1+val2;

val1=val2;

val2=swap;

yield swap;

}

}

functioninit(){

leti=0;

while(i<10){

console.log(fib.next().value);

i++;

}

}

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 fib.next() call 10 times to get the first 10 numbers.

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 LocalBitcoins.com which has many ways to buy and sell Bitcoins person-to-person.

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 help@example.com 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.