Kuala Lumpur 2018

November 10 to 16

Highways and Traffic

Almost all their major roads are smoother than SLEX. Traffic looks bearable because cars actually respect lanes. Motorcycles, however, are still pedestrians on engines. This just made me feel frustrated about Manila.

Vortex at KLCC

The unit itself was pretty nice. I guess having a local IKEA does wonders. We had a washing machine. I should’ve brought half the clothes that I did. There’s a pool and sauna that I got to use a bit. The place is right in the middle of the metro, and close to all transpo options.

Free Bus and Aircon Walkways

I wonder who funds it? What if we had that in Manila? How much would it cost? How much would we get out of it? I have a feeling that the benefits would far outweigh the cost.

Pavilion at Bukit Bintang

This place is just awe-inspiring. I get that it’s a high-end mall but, man, the sheer size of the place is just insane.


You’re an adult when you get excited going around IKEA. I saw like 3573839393 things I wanted to buy but couldn’t because 1) money and 2) baggage allowance. Sad life. JJ was exactly the same.

Also, I missed that berry jam on brown sauce for the meatballs. I think I should try going back to Norway one of these years.


I wonder how much those original Mont Blanc bags cost?

Grab to airport

His hood went up twice while we were at the expressway. The first time was really scary because we were going around 120km/h at the fast/overtake lane right next to a truck.

I felt bad for him because the airport was 40 minutes away from the city proper. I wonder how he’s going to have his car fixed.

Waiting for Boarding

Someone hit me up for conversation while waiting – Danny from Muñoz that came from New Zealand on his way home for an emergency with tickets he bought the day before for 1800 NZD. He gets paid 22 NZD per hour.

Intelimina Plans

We actually went there to plan. I felt it was productive and it was nice seeing everyone join in coming up of what we should be working on as a team on one of our products. We didn’t cover the other products, and we totally should, but that’s mostly on me for now.

Back in Manila

It’s hot and traffic is as slow as always. Wrote this at the back of my Grab, going to BGC. I’m back.

On Becoming Who You Are

As it turns out, to “become who you are” is not about finding a “who” you have always been looking for. It is not about separating “you” off from everything else. And it is not about existing as you truly “are” for all time. The self does not lie passively in wait for us to discover it. Selfhood is made in the active, ongoing process, in the German verb werden, “to become.” The enduring nature of being human is to turn into something else, which should not be confused with going somewhere else. This may come as a great disappointment to one who goes in search of the self. What one is, essentially, is this active transformation, nothing more, nothing less. This is not a grand wisdom quest or a hero’s journey, and it doesn’t require one to escape to the mountains. No mountain is high enough.

Just found this passage from one of the few mailing lists I subscribe to. I think that’s by John Kaag as he ruminates on Nietzsche’s philosophy. This is the book. I haven’t read it yet, maybe one of these days.

Love, Like, Dislike, Hate – Meditations on Gifts Part 1

I tried to make this a 5x5x5x5 but I’m taking so much time on the dislike/hate part.

  1. I enjoy learning new skills by applying them. I learn best when under external pressure (I have billed the client already).
  2. I enjoy explaining things to people because it reassures me the level of knowledge that I have – or don’t have – and it forces me to compose my understanding to something that can be communicated.
  3. I enjoy seeing problems get solved with constructs of my design.
  4. I enjoy creating things as part of the process of learning new skills.
  5. I enjoy seeing my progress in mastery of the skill.
  1. I like considering new point of views, trying to view something based on another level’s perspective. I ponder a lot; chewing upon thoughts like chewing gum.
  2. I like talking with other people if we’re talking about concepts or their informed opinions on things and how they’ve come to that opinion.
  3. I like experiencing new things and learning something about myself in the process.
  4. I like helping other people by giving them opportunities.
  5. I like planning out my day, my finances, my food – even though I need to work on the actual following the plan thing.
  1. I dislike talking about mundane things. Can we just skip the small talk and get on with discussing deep stuff?
  2. I dislike social media because it’s distracting and it is a huge time and attention sink, not just for me, but also for other people.
  1. I hate the feeling of lack of resources.
  2. I hate the feeling of rejection.
  3. I hate traveling.
  4. I hate not being able to keep my promises.
special mentions

I have a love-hate relationship with gaming. I like games because they’re mentally engaging. It triggers my min-max persona a lot. Anyone who’ve played with me will be able to tell you how much I get into games.

But games also triggers a sense of losing control on my part. That I just can’t stop myself. It’s an addiction.

There’s also a sense of waste when I play. I’ve invested so much time and effort into playing and I have nothing to show for my investment.


Deploying NextJS to Heroku

This took me quite sometime to figure out, so I hope this helps:

  1. Follow Heroku’s instructions on Getting Started on Node.js up until “Deploy the app”
  2. At this point, visiting your site via heroku open will only show an error
  3. Modify your package.json to include the following scripts:
  4. "scripts": {
      // ...
      "heroku-postbuild": "next build",
      "start": "next start -p $PORT"
  5. Push to Heroku again, and voila, it should now work.

Retention Hypothesis: Trust and Responsibility

For a company in the service business, especially one as small as us, as cliché as it sounds, our people are our greatest asset.

Retaining talent is very important for us to execute at the level that we do.

My hypothesis are the following:

  • Trust your employees to do what’s right for the company
  • Reduce the impact of mistakes

In a fundamental level, the basis of our retention hypothesis is trust. We provide the vision, the direction and the goals but we trust the employees on the implementation details. This is incredibly hard to do, especially if you’re as big as a control freak as I am.

But trust is a two-way street. Once the trust has been broken, it will be an incredibly long process to get it back.

More details in a future post.

Happy Labor Day!


Making ActiveRecord associations readonly based on state

My use-case:

* Trip has many destinations and travelers
* Trip states are: 
draft -> checked out -> paid
draft -> checked out -> failed (which should allow them to edit again)

* Trip workflow actually is: 
being edited -> for confirmation -> go to payment gateway (set to checked out) -> go back to success/fail
payment gateway sends payment details to system whether payment was success (paid) or failed (failed)

To disable editing on trip:

class Trip < ApplicationRecord
  def readonly?

  def draft?

  def checked_out?
    return false if checked_out_on_changed?
    # this is required, otherwise saving the relations will always fail
    # as draft will always return false even during the saving process

To disable changes on related records (destination/traveler):

class Destination < ApplicationRecord
  validate :trip_is_in_draft

  def trip_is_in_draft
    errors.add(:trip, "should be in draft") if !trip.draft?

Testing Email Deliveries using Cucumber/Capybara/Minitest

# features/support/env.rb
Around('@email') do |scenario, block|
  ActionMailer::Base.delivery_method = :test
  ActionMailer::Base.perform_deliveries = true

  old_adapter = ActiveJob::Base.queue_adapter
  ActiveJob::Base.queue_adapter = :inline
  # ActiveJob::Base.queue_adapter.perform_enqueued_jobs = true

  ActiveJob::Base.queue_adapter = old_adapter

# features/steps/*_step.rb

Then(/^I should receive an email$/) do
  # assuming mailcatcher
  assert_difference -> { ActionMailer::Base.deliveries.length } do
    # do stuff that is supposed to send an email

# features/*.feature

Scenario: Checkout page
  When I press the checkout button
  Then I should receive an email

Removing field name from validation error message


Related to the accepted answer and another answer down the list:

I’m confirming that nanamkim’s fork of custom-err-msg works with Rails 5, and with the locale setup.

You just need to start the locale message with a caret and it shouldn’t display the attribute name in the message.

A model defined as:

class Item < ApplicationRecord
  validates :name, presence: true

with the following en.yml:

              blank: "^You can't create an item without a name."

item.errors.full_messages will display:

You can't create an item without a name

instead of the usual

Name You can't create an item without a name

How to create a PORO model and use it in Rails Form Helpers

First off, I’ll start with our use-case:

We have a fairly simple form for an item with some complexity. It would have default values derived from the current_user‘s attributes but would still have the field on its own. Overriding it in Item model feels like overkill (and starts to be a violation of SRP) so we set out to create a PORO model for it. Full code and explanation below the fold.

Continue reading How to create a PORO model and use it in Rails Form Helpers