Through the binary

a full stack enthusiast interested in Javascript / Typescript / Kotlin / Python / React / React Native / (Android & iOS) native / Cloud

We use Promise.all() in javascript when we want to do something after resolving a promise queue. Let’s use 3 examples to see the use cases. And hopefully you could understand more about the execution order of some variations. I use the built-in Promise of node v6.10.2 to do the DEMO.

Read more »

I recently changed from Mocha, Chai to Jest. Pretty lovely experiences. It took a while to figure out the right way to test an express route, but when it works, it works like a charm. I share my experiences here, hope it helps. I love jest assertion function more than Chai, seems more concise to me.

Read more »

Kivy is a python framework you can use to develop apps for Linux, Windows, OS X, Android and iOS. It’s very common to create your folder to store some information which you can access across sessions. But things always get interesting in a across platforms framework since different behaviours for each platforms. Let’s discuss them all.

Read more »

Previously, when I tried to set up webpack‘s HMR for my own React develop environment, I encountered a weird thing, I followed the official tutorial, and still can’t get it work, it’s interesting to see that there is no error message. All the messages indicate that the system thinks it should work as expected. But actually it’s not.

This is how I made it work at last, think it worths a note. And I contributed a pull request to the official webpack documents and gets accepted.

Read more »

I’m not a big fan of black magic, especially when I set up my development environment. Every module I have installed, I want to know exactly what problem does it solve. And every feature I have used, I want to know how to customize it to suit my needs. You could use create-react-app, but I like to manage all the things by my own hands because I always have so many things which I want to tweak my way.

Now let’s set up a React environment with Tests, ES6 and bundle enabled (With HMR).

We’ll go through every step and explain why we need that module.

Read more »

Recently, I have refactored a legacy code base. It’s a mobile app written via python and using a framework named Kivy. It’s quite a happy experience since the old one is good start for a refactoring, one folder to hold all files, one file to hold all logic, useless-over-complex logic, everything clued together, global comes from nowhere, no naming conventions.

We don’t only deliver products, but also clean code base. That’s what we do for a living.

Most the experiences below comes from my previous practices of mobile dev, web dev and back-end dev. But without any surprising, they all fit in this project. And they should be adaptable to all languages as well.

Read more »

Recently I finished my last paper for my study programm - Game Development, the final project is a 2D fighting game developed using Unity, I am responsible for anything related to the enemy (AI, state machine, animation tree, including Boss), openning cut scene, and a QTE(quick time event) system as well. We did a pretty well job and finally get a A+ for this paper. But still lots of lessons have been learned through the whole procedure. The biggest lesson is the coding pattern for a character which heavily relies on animation.

Read more »

A game is all about animation, your character plays different animations according to different states. When you develop a 2D game,sometimes you might need to change the direction that your character faces, it requires different animations, and if your game is a 8 direction game, it will be 8 animations for each action (run, walk, shoot, etc). It is a nightmare to create them in the animation view and transition them in code.

Read more »

As Wikipedia said, code coverage is a measure used to describe the degree to which the source code of a program is executed when a particular test suite runs. Low code coverage means you haven’t tested your code thoroughly. In javascript, you can use install istanbul to check it, but problems come again when you try to run it against ES6 code. Either syntax error for ES6 code or No coverage information was collected, I finally found an relative elegant way to solve.

Read more »
0%