Why care about SEO?

Why get involved when you know it’s not necessary?

Ask yourself, why do I need my blog to rank high on Google?

If I asked myself that question and answered with full honesty, there will be silence. There’s no need for my articles to rank well. An article that is helpful will naturally rank better than one that isn’t. A blog that is on the whole more useful to people ranks better than a fully decked out search engine optimised blog.

And what if I’m wrong? Does it matter? I write because it’s fun and helpful to people. That’s all that matters to me – fun and useful.

Yet I’ve been customising my keywords and Google snippets and all that nonsense ever since I started blogging. Why? I don’t know, perhaps to gain more reach? Why do I need more reach? What does reach mean anyway?

This is one of the things I’ve recently taken a moment to reconsider. It’s a great idea to take periodic pauses in your life to question your day-to-day actions. It’s the best way to reduce unnecessary redundancies and move with lighter feet.

Wait less do more

After doing the work–to follow up on a lead or apply for a job–it easily feels like we deserve an answer. That we have cast the net and now we should expect some fishes to swim right in…

But the truth is, those fish may never come.

Life has a rhythm and from what I know, regardless of what that rhythm really is, one thing is certain – it moves forward. The best strategy then is to cast that net and just keep swimming. Don’t waste time waiting.

Whenever you feel like that email from the prospective client or employer should be in your inbox this time when you check, resist checking your email. Do something that actually propels you forward instead, and you might just catch the next wave (and a big fish).

Find the smallest number in an array with JavaScript

Let’s say you’re given an array of numbers, and you’re required to find the smallest number in the array. How would you do it?

Though I didn’t find this challenge difficult to complete, my solution looked like a Toyota Prius next to the Tesla I saw on Codewars today.

Here’s what I would have done normally:

And this is what I saw on Codewars today:

Edge cases like an empty array and arrays with elements other than Number type aside (which neither solutions bother themselves with), this second solution is superior in almost every way to mine.

Isn’t that a nice looking line of code, Math.min.apply(null, numbers)?

It’s pretty to look at and very easy to understand. Math.min(a, b, c[, ...]) normally returns the lowest value among all the arguments passed into it, but the problem is that it doesn’t accept arrays. That’s where .apply comes into play.

function.apply(thisArg, [argsArray]) accepts two arguments. thisArg is for explicitly stating which object this should refer to. [argsArray] is whatever arguments you’d like to pass into the original function in the format of an array.

The clever part is combining the power of two in-built JavaScript methods (both available in ECMAScript 5) to carry out this operation. The only caveat is the length of the array cannot exceed 65536, as in [1,2,3,…,65535,65536]. It’s likely an arbitrarily set figure, but with good reason. Stack overflow?

To find the max number, just do Math.max.apply!

More on the apply method at MDN.

UPDATE: With ECMAScript 2015 (ES6), it’s become slightly easier to achieve the same thing. The big difference is how clean it looks in ES6 using the ‘spread’ (...) operator:

Bye bye Airbnb

It’s 9:50pm on an otherwise wonderful Sunday night, and two officers from Certis Cisco, under the appointment of URA stood outside my door. They are here to bring us back to square one.

We had a good thing going, my wife and I, renting out our spare bedroom to guests from all over the world. Airbnb represented an opportunity for us to have the world come to us (since we can’t go to the world right now) while we worked at our otherwise normal jobs.

Guests gave us 5 star reviews almost all the time and said many good things when they didn’t have to. Here’s a secret – it wasn’t that difficult becoming Superheats. All you need to do is say hi and mean it, show your guests their room for the next couple of days and the facilities at home they can and shouldn’t use, point out that you’ve prepared a purple folder that tells them all the things they need to know to understand what Singapore stands for and how to navigate the landscape. Most tourists haven’t experienced such personalised hospitality before, especially not in Singapore, and I’d chalk our good reviews to that.

nick airbnb singapore listing
Our listing on Airbnb – I think we were decent hosts

The guests who hailed from USA, UK, Brazil, Denmark, Taiwan, Philippines, Hong Kong, Malaysia, Indonesia, China, Australia, New Zealand… they continued to surprise us as they were mostly gracious guests. Some were actually so nice that we remain friends till this day, like Sherry and Keng in New York, and Wan Ting and Kiki from Hong Kong. It was an amicable enterprise between us and the tourists here to have a good time while having an authentic Singaporean home to stay in. That is, while it lasted.

Things started to decline one day when our condo manager ordered the guardroom to bar some of our guests from entering the condo. Apparently some residents who happened to be on the management council saw a group of 3 white people at the entrance and decided there and then that this was illegal and they should be denied entry. I couldn’t let my guests who came all the way from the Europe stay out there in the cold and I demanded that they be let in, and in exchange I promised to have a civil discussion about the matter with the manager and, should they be willing, the resident management council the next day.

That discussion only ever amounted to a monologue. Nobody on the management council wanted to see me to talk. And less than a week later, two officers stood at my door and asked to enter our home. Having read the Planning Act, I knew I had to let them in.

Two separate “investigations” at our home and a meeting with the URA coordinating officer later, here we are. Our enterprise was forcefully dismantled (with a cessation notice, Singapore style) and well, life goes on.

Today in their third and final ‘surprise’ visit to our home, which was meant to verify that we’ve adhered to the notice, I couldn’t help but notice how pathetic things are. In my pyjamas I accompanied them around my home as they snapped pictures of every room and categorisable space, and as we walked from one empty room to another, two of which still holding vacant beds, I shook my head. What a waste.

Our government probably wants to collect taxes from us for renting activity, which I think is fair. Propose something and let us have a discussion. But nobody I’ve met from government has ever broached the topic until we addressed the elephant in the room at our meeting with the URA officer. Even then, he gave us textbook responses that he was expected to give as an executive of the agency – that they are merely responding to complains from the neighbours.

Our neighbours probably wanted us to pay more maintenance fees because we had more people living in our apartment. Either that or they are xenophobic, unapologetic elitists, or both. The argument that greater headcount means more fees doesn’t hold water, since our household consisted only of me and my wife before Airbnb, while many other households in the estate had children. If the counter argument is “they are foreigners and thus, represent higher damage risk to facilities”, then I think I’m already proven right. Oddly enough, most of the renting tenants here are not Singaporean.

I realise that I’m getting more sour with every sentence and so I will wrap up since I didn’t intend for this to be a rant. I believe Airbnb is good for Singapore’s economy because with it, accommodation becomes more affordable and quite possibly, a great deal more personal. Airbnb is of course not so good for the hospitality industry from what I can observe.

Also, if the government isn’t collecting taxes from guests or hosts, then they are probably unhappy too. But if they are, it’s good for them as it is good for us hosts. ‘Host’, by the way, really just refers to people with spare rooms in the home they live in that they want to rent out to tourists.

As I said bye to the two officers tonight, I’m back to where we began a few months ago, with empty rooms just staring back at us, in a city spanning 27km by 50km (720 square km) with 5.4 million people. I hope the decision makers will wake up and make better decisions soon. Reactive policies do not bode well for us – this is hardly the image of a smart city.

Breaking the coding

Coding feels like a chore today.

It took me a while to even entertain the idea that I might be experiencing coding fatigue. To be honest, this admission feels like defeat.

my github contributions grid
My GitHub contribution grid is lighting green recently

I’ve been writing code every day–JavaScript and Ruby, I’m looking at you–for the past 3 months and I think it’s time to take a short break. Actually, more like I feel the need to break away from the colourful text on black.

For the past three days I’ve been forcing myself to work on my past projects, to squash bugs and add a veneer of UX polish to them before our Meet and Greet day scheduled for the 17th. Looking at what I’ve managed to get done though, those days amounted to no more than half a day’s work on any given day. What’s the point?

So I’m going to take a day, maybe half a day, away from Atom (code editor). Since Donald Trump literally just became the President of the United States of America, I think being away from the computer altogether is somewhat a good idea.

What I’ve learned from this episode of fatigue is that the ability to recognise yourself reaching a point of saturation may not come naturally to some. For people like me who can get stupidly excited about things when it starts to get interesting (ie. when I start to be proficient at it), the indicator of fatigue is about as bright as a star in the city sky.

Let’s face it. Feeling tired is a thing, and it’s a thing that we must acknowledge, not brush aside. The outcome of ignoring it is a dip in productivity and general lethargy, as I’m experiencing just before I started writing this.

There’s no shame in not wanting to do X just because you’ve done too much of it recently. I can imagine Obama echoing this sentiment right now. Without variety, life can be dull. And what goodness can come out of a dull person?

I’m bored of writing code today, so I’m closing my laptop and choosing to read a book instead. Maybe I’ll watch Black Mirror. Perhaps at night we’ll go out for a nice dinner.

Sounds good.

I don’t doubt it – this will get boring soon. And when it does, I’ll revisit my old friend Atom.