Category Archives: General

The general entries.

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.

Contributing on GitHub

Collabocats

After you forked a project and merged back to the original, you can simply delete the forked project.

If you are like me, I always forgot to delete the forked project. When I need to contribute again, I need to bring my forked project up to date with the original source.

There are two ways to do.

  1. Deleted the forked project and fork again.
  2. Bring the forked project up to date with the original.

The #1 is easy.

The #2 is also easy with command line.

In order to bring the forked project up to date, do the following:

  1. git checkout master
  2. git pull ssh://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git master
  3. git pull origin master

The above steps are assume no conflict. If there is, you need to take care of it. A more detail instruction can be see from GitHub Help.

How I Work (2019)

Office

I have external two monitors and I kept the laptop open, but I think I can survive with two monitors. The main monitor usually use for the text editor, terminal, and browser. The monitor is display vertically to view documentation or issues. The laptop screen sometimes has Trello, but I think most of the time it has nothing on it.

I recently replaced the magic mouse with a magic trackpad. It was a no brainer to use the magic trackpad if you are on a mac.

Machines

My work has graciously upgraded my machine with a mac last year. It’s a 13-inch MacBook Pro with i5 and 8G ram. It’s powerful enough to do my work. The alternative machine is a Dell XPS 13. Ever since I got the mac, I only turn it on once a month or whenever work is necessary.

Editor

Sublime Text with Colorsublime GitHub Light theme and Roboto Mono font. The mono file icon is from Braver. It works perfectly for me.

(We should never tell another programmer on what text editor, theme, or font to use. )

Terminal

The default terminal.app. I switch from bash to zsh a month ago and I never look back. So, my .dotfiles repo seems pretty useless now, except for the vim setup part. The plugins I use are aws, git, laravel5, tmux, and z. I have the tmux autostart flag turns on so each time I launch a terminal, tmux is already launched.

Environment

I use Homestead and if I need something extra, I use docker.

Notebook

Muji Weekly Planner

I use Muji’s Weekly planner. It’s a perfect notebook for me because it’s a weekly planner and the note is squared.

Music

I use Spotify. I was a Google Music user, but the YouTube Music thing got me turned away from it. It’s so sad.

In Spotify, I use their curated focus playlists, it’s helpful. Otherwise, I listen to the musics from Hong Kong and Taiwan.

Misc

  • GMail
  • Google Calendar
  • Google Drive / Google Drive File Stream
  • SequelPro
  • Spectacle
  • Spotlight
  • Trello

Public reach

A tweet from @dhh

I think this can be done. (or should be done.) More than happy to join the team.

Back to WordPress

After almost a year on leaving WordPress to Medium, I decided to (partially) move back to WordPress.

It was the one feature I cannot live without from WordPress. It was the automatically embed of book when I post the book link from Amazon.

As I like to blog about the book I read, I found it will be very helpful to those who landed on my book review immediately has a glimpse of the book. As of now, Medium does not has this feature.

As of today, I will post my book review from WordPress only. The other stuff such as programming and random thoughts, I will keep it at Medium.