My New Year’s resolution for 2018

moleskine notebook on a table
The Moleskine notebook I used every step of the way in 2017

I’m not doing this for the sake of tradition or anything like that. Instead, I’d just like to make use of the pensiveness that comes for free at the end of the year to do some visualisation of what the new year is going to be like for me, my wife, and my dog.

Continue reading “My New Year’s resolution for 2018”

Success needs health

Singapore laksa from a nearby makeshift food court near work

All the success in the world means nothing if you don’t have good health to enjoy it.

Charlane (my wife) seems to be down with food poisoning tonight. It’s one of those unpredictable, common-ish illnesses that can swoop down on you without warning and render your body totally useless.

One moment we were going to enjoy a simple dinner together in between her makeup gigs, and the next moment she’s puking in the toilet 3 times in 20 minutes. Ugh. We’re biology after all.

Continue reading “Success needs health”

What to do when your bike runs out of fuel

bike motorcycle
Photo by Les Anderson

Hello, friend. If you’re here for an actual guide on what to do when your bike runs out of fuel, skip ahead to the “What to do when your bike runs out of fuel” section below. I’ll be recounting my own experience today first in the proceeding section.

Today after knocking off from work, I hopped on my Honda Shadow 400 and rode away from the office. I was ready to go home to my wife and dog after a long day at work.

Three minutes into the 30 minutes journey though, I noticed my engine getting softer… and I immediately knew that it was running out of fuel. My eyebrows grew heavy.

Continue reading “What to do when your bike runs out of fuel”

Remember why you are programming

spectacles sitting in front of a laptop focusing text on screen - remember why you are programming blog post banner
Photo by Kevin on Unsplash

As a programmer, you probably get a little carried away once in a while. You know, getting engrossed in the sophistication of another developer’s implementation, be it beautiful or ugly (or both) and having an engaging conversation with your colleague about it. Yeah, I can tell you know what I’m talking about!

But I recently realised that that can sometimes happen at the expense of good user-centric development.

Continue reading “Remember why you are programming”

Implementing a Queue in JavaScript?

Yesterday I asked myself whether it was necessary to implement a stack abstract data type in JavaScript. The answer turned out to be “no,” because you can just use the built-in Array data type to simulate a stack without obvious performance penalties.

Naturally, I started asking myself, what about a queue? Should we be implementing a queue in JavaScript?

Continue reading “Implementing a Queue in JavaScript?”

Why implement Stack in JavaScript when you have Array?

This is the stupidly simple question I asked myself today as I was trying to familiarise myself with data structures. Is there ever a need to implement a stack data structure in JavaScript when the built-in Array data structure already exists?

Based on my short research, the answer is no – there’s probably no need to implement a separate Stack constructor function or class in JavaScript. Since Array already has the typical methods you’d need for a stack to work, like push() and pop(), you can just use an array to simulate a stack.

Continue reading “Why implement Stack in JavaScript when you have Array?”

Bubble sort explained

bubble sort explained banner
Photo by Sime Basioli on Unsplash

The goal of bubble sort is to sort an array in ascending or descending order according to a sortable property.

In our example below, we just use an array of integers to directly simulate the sortable property (a number), but in reality, you can imagine that that probably isn’t a frequent use case. What’s probably more common is sorting an array of objects by one of their properties, like IDs.

Continue reading “Bubble sort explained”