Data Engineering

Downloading All Public GitHub Gist Files

I used to use plug-ins to render code blocks for this blog. Yesterday, I decided to move all the code into GitHub Gist and inject them from there. Using a WordPress plugin to render code blocks can be problematic when update happens. Plugins might not be up to date. It …

Front-End

Calling Async Function in Action with Redux-Thunk

Redux-thunk is a simple middleware that enables you to call functions in redux action. Thunk means function returning function. In JavaScript programming, we use thunk all the time although we may not use the name. Wikipedia has a simple example of thunk if you are interested. As the name suggests, …

Front-End

Setting up Unit Tests for React with Mocha, JSDOM and Enzyme

Before start coding your awesome React app, it is always a good idea to set up unit test infrastructure. Once test is set up, you can write tests whenever you feel necessary before waiting to complete the entire app development. Mocha is a JavaScript test framework that runs on Node.js. …

Front-End

Refactoring React ES6 Class Components with Property Initialisers

“Proprty initialisers” is an experimental ES6 JavaScript feature that allows you to write React class components without constructor and bind this. It creates cleaner React class component. The use of this syntax is so wide-spread and calling it experimental (because it is not yet ratified) feels almost misleading. Before getting …

Front-End

Clarifying Which Babel to Use for Compiling React Today

Babel is a toolchain to transpile new JavaScript syntax (e.g. ES6) down to older versions that is supported by browser or node.js execution environments. The latest major version at the moment is Babel 7. To transpile JavaScript React, we normally use bable. The problem is that babel is evolving so …