Author Archives: Kennith

Jet Lag

I recently traveled to Asia for vacation. It was located at a 16 hours different time zone from home base.

It was not my first time travelling to Asia and I always had a hard time adjusting to the new time zone when I was there and when I returned home.

This time, I did something different and it helped me a lot.

On the first two days upon arriving and returning, I slept whenever I felt tired. I sleet at 3pm local time and woke up at 1am local time, but it’s OK. I was not forcing myself to adjust to the local time, but let my body dictate the sleeping pattern.

On the third day, things will go by easily and much easier to adjust to the local time.

It sounds like a waste of time on the first two days, but I did enjoy the rest of the trips.

Advertisements

Homestead + dnsmasq

Homestead and dnsmasq

In Laravel, there are two out of the box setups. One is using Homestead and the other one is using Valet.

I personally prefer using Homestead because it is entirely on a virtual machine and it does not affect the host OS. If anything goes wrong, I can simply just destroy the Homestead virtual machine and start a fresh box.

One of the annoyance to me using Homestead is whenever I create a new project and giving it a unique URL, e.g. project-1.example.test, I have to edit the /etc/hosts file and add the domain to the list in order for the new URL to work.

Instead of editing the hosts file each time, I started using dnsmasq to proxy all the example.test to the IP address of the Homestead machine.

The setup is straight forward, here is my steps.

  1. brew install dnsmasq
  2. mkdir /etc/resolver
  3. touch /etc/resolver/example.test
  4. Edit /etc/resolver/example.test and add nameserver 127.0.0.1 at the top of the line.
  5. Edit /usr/local/etc/dnsmasq.conf and add address=/.example.com/<your homestead box ip> in somewhere beneath #address=/double-click.net/127.0.0.1.
  6. Start dnsmasq with sudo brew services start dnsmasq

Bad Blood

I simply amazed how insane the CEO of Theranos, Elizabeth Holmes, when she was running the company.

The FOMO (Feare of Missing Out) culture and the fake it until you make it mentality made this possible.

Instead of choosing to condemn the multiple people in the faults, I want to praise the people who bought this crime into light, namely, Tyler Schulz, Erika Cheung, Gary Betz, Gary Yamamoto, and John Carreyrou.

Laravel Resourceful Route Without Prefix

The resource controller contain a method for each of the available resource operations.

For example:

Route::resource('photos', 'PhotoController');

is handle by the verbs in the controller. such as

/photos
/photos/create
/photos/{photo}
/photos/{photo}/edit
...

If you want the resource without the name, you can do

Route::resource('/', 'PhotoController');

but the parameters will not work properly since the route will become

/
/create
/{}
/{}/edit

in order to “fix” that, you can do

Route::resource('/', 'PhotoController')->parameters([
  '' => 'photo',
]);

so the route now is

/
/create
/{photo}
/{photo}/edit

The Fifth Risk

I reenforce my perspective on the following two items after reading this book.

  1. Whoever yell the loudest or appear the most glamorous do not necessary translate to value.
  2. We cannot and should not privatize the government services.