WordCamp Vancouver 2018

I missed the opening and keynote and also skipped the after party at a bar because I was just too tired and forgot to bring my driver’s license. Overall, the event was great! Foodies-wise, I had some fruits and 1 cupcake for breakfast, 2 sandwiches for lunch, 1 sprite and 3 cups of coffee throughout the day. Lots of cool swags! I don’t even know how this event was only $25. Some of these talks definitely value more than $25. A lot of thanks all those who made this happened!!

Anyways, here are some of my notes from the session that I’ve attended:

Continue reading

ES8 – Callback, Promise and Async

Callbacks: Pass in a function as a parameter

function fetchData(callback) { 
    callback(); 
}

 

Promise: States: Pending, Fulfilled, Rejected

function fetchData() { 
    return new Promise((resolve, reject) => { 
        resolve(rides), 

        // if error:
        reject(errorInfo)
    });
};

 

Promise.all:
takes multiple promises and returns a promise which resolves when all supplied promises are done.

Promise.race:
takes multiple promises and resolves when the first promise is done.

 

async()


// Running sequentially: asyncFunc1 is run before asyncFunc2
async () => { 
    await asyncFunc1(); 
    await asyncFunc2(); 
}


// Running in parallel
async () => { 
    await Promise.all([asyncFunc1(), asyncFunc2()]); 
}

 

ES8 – Array and Exponent

ES8 aka. ES2017

Array.prototype custom function (review)

let number = [1, 2, 3, 4]; 
let moreNumbers = new Array (1, 2, 3, 4); 

Array.protype.count = function() { 
    return this.length;
}

console.log(numbers.count());     // outputs 4
console.log(moreNumbers.count()); // outputs 4

 

Array.prototype.includes

Check if an array contains a specific value and returns a boolean.

let letters = ['a', 'b', 'c', NaN]; 
letters.includes('b');      // true
letters.includes('d');      // false

// includes is similar to indexOf from older version 
letters.indexOf('b') >= 0   // true

// when includes and indexOf is different: 
letters.includes(NaN)       // true
letters.indexOf(NaN) >= 0   // false

 

Exponential syntax: **

3 ** 4 = Math.pow(3, 4)

 

[Book] One Minute Manager

I just finished reading one minute manager. Unlike other self-development books that present a central idea and discuss points in paragraphs, the audience of this book basically absorbing the new management system by following the journey of a young active learner. It’s as if I was reading a fictional book.

Near the end of the book, I found this little conversation rather interesting:

“I like you, young man,” the manager said. “How would you like to go to work here?”

The young man put down his notebook and stared in amazement. “You mean go to work for you?” he asked enthusiastically.

“No. I mean go to work for yourself like the other people in my department. Nobody ever really works for anybody else. I just help people work better and in the process they benefit our organization.”

It’s similar to a saying that “I have no allies/friends; I only happened to work/play with people that share the same goals/interests as me.” Okay, maybe not exactly that, but the manager’s answer clearly says that he is here to help you grow, not bossing you. 😀

Here’s the central idea of how this management system work:

It was a fun read. Definitely go check it out!!