Sign in

Do you know what a leap year is? You know, the extra day you get roughly every four years? It has its origin from the calendar system the majority of the world is currently using: the Gregorian Calendar, also standardised as ISO 8601.

In plain terms, the rule to determine whether a given year is a leap year or not is as follows:

  • If the year is divisible by 4, then it is a leap year; except
  • If the year is divisible by 100, then it is not a leap year; unless
  • If the year is divisible by 400, then…

To be honest with you, I should not have bought another watch. Hell, I even said so myself mere days ago, and here I am, looking at another watch in my not inconsiderable watch collection.

Surprisingly, I did not suffer too much from buyer’s remorse as I thought I would, or perhaps I am still in denial of it. This watch actually feels like it should have been in my collection a long time ago, and unfortunately I cannot say the same for some of my other watch purchases.

Yes, you should have guessed it by now. It is the…

Random thoughts I had over the course of 2020:

  • Have had the biggest surgery of my life so far. Lost half of my hearing on my left. Life has been frustrating. On one hand, speech comprehension has been affected, I can hear people talking but I sometimes could not make out what they are trying to say; on the other hand, I am too embarrassed and arrogant to ask people to repeat themselves. The smile-and-nod, has been a relative staple in my interactions with people in 2020, but people speaking with masks on, made things even more complicated…but what can…

This is a continuation of my previous article, How to live with a brain tumour (Part I)

The big day

We left off at my decision to undergo the Cyberknife radiosurgery.

Apart from your standard run-of-the-mill MRI scans to prepare for the surgery, I was also required to have a custom heat-moulded head mask made a few days before the actual surgery so that the software could calculate and pinpoint the exact location of the tumour. Because the prep and the surgery would be on different days, the mask and markers ensured my body would be in the same exact position.

My oncologist…

Hi. I am Rex. I am 30 years old and I have a brain tumour. This is a record of what happened since I first discovered it.

April 2019

I was born with a pair of waxy ears. A year and a half ago, I was trying to be smart and bought an ear pick tool with a USB camera online trying to deal with the problem myself (please don’t repeat the same mistake as I did). I accidentally poked my eardrums lightly on both ears. It was not painful or anything. My right ear was perfectly fine but I lost almost…

We live in strange times. In my hometown Hong Kong, there were the Anti-Extradition protests in 2019, closely followed by the Wuhan Coronavirus in 2020 — my Government announcing their ‘Truth about Hong Kong’, officials whitewashing police brutality, citizens panic buying and price-gougers setting ridiculous prices for masks, all stem from the very fact that information is almost always disproportionately disseminated and processed. People appealing to authority without even slightly questioning their version of ‘truth’ because they never knew better.

As someone working in IT, or in a more general sense, as a knowledge worker, we always strive to make…

I must admit, I am a bit of a watch nerd. I love watches and I probably have too many for my own good.

I recently watched a YouTube video challenging the viewers to find out the fake Rolex among the three Rolex Submariners that the guy is showing.

At first, it was really difficult for me, I don’t own a Submariner and given the pervasiveness of fake Rolexes, I am certainly not expert enough to differentiate the subtle nuances between the fake and genuine.

Jody, the host of the channel also showed how difficult it is to identify…

A typical list sum function written in Haskell

I have always been asked what is a good starting point in learning functional programming. The answer I always have is — lists. They are built-in for almost all functional programming (FP) languages and has the most gentle learning curve for beginners.

Lists in object-oriented programming (OOP) — in the form of arrays, list classes — act very differently than the one commonly used in FP. In C or JavaScript, you might commonly see code like:

Here you can see although the list reference is immutable, its content is not. …

One example of using closures in JavaScript

In the world of programming, it is inevitable to keep track of states, irrespective of the paradigm you use. There are, of course, a myriad of ways to accomplish this. For example, in mainstream object-oriented programming, states can be modelled as fields (in objects); in functional programming, states can be modelled in the form of closures.

I read a funny yet enlightening story a few years ago that gave me an epiphany.

The venerable master Qc Na was walking with his student, Anton. Hoping to prompt the master into a discussion, Anton said “Master, I have heard that objects are…

I always marvel at the elegance of the Haskell language, especially how trivially easy it is to construct non-strict (which is not quite the same as lazy) values and just let the runtime handle everything for you.

For example, undefined is the bottom type (for readers for familiar with OO, it is akin to an Exception in C/Java) in Haskell. Evaluating undefined in GHCI throws an exception:

A bit of background for those who are not familiar with GHCI: GHCI is the read-print-eval loop (REPL) interactive program for developers to test out a small snippet of Haskell code. It is…

Rex Ng

Programmer | Watch enthusiast

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store