Use Slack as notification service in your workflow

This article intend to give some pointers to developers new to Slack on how to integrate their services / workflow with it. You can add a message to Slack and get notified as simple as a command like this:

My Use case

So my main purpose of using Slack it to get notified with certain events happen and implement it with minimum effort. For example, Continue reading

10 common usage of lodash

lodash is a excellent tool library for every javascript developer. It is similar to underscore, but smaller. It is always come in handy to keep it in your toolchain.

map

This should be quite familiar for most JS developers. It iterate through a collection and perform a 1-to-1 mapping.

mapValues

mapValues is just like map but instead of the key being iterate Continue reading

Android Emulator crash/error when downloading file

When you use Android Emulator with “Marshmellow” (6.0) SDK, and want to download a file with the Browser app. You may get the following situation:

  1. “an sd card is required to download”
  2. Force close

After some struggle, I have found that it is because your browser app has no permission to access the Storage. Adding Storage permission in the Settings will solve the problem.

Cannot start Android Emulator (initial hax sync failed)

If you see something like this when booting Android Emulator:

It is likely that one of the following app is running:

  1. Virtualbox
  2. Docker
  3. Other virtual machine applications

Stop all of them, and try again.

Simple command to monitor directory changes on Mac

Sometimes you want to know if a certain App/code/IDE changed something on the disk, this little script / command may come in handy.

Install fswatch

install fswatch as a global command

The script

Only fswatch is not enough, here is the script that does the trick

Save as a script e.g. monitor.sh, then give it executable permission

Now run the script and supply the path as parameter, and you will start monitoring the directory

Enjoy!

Migrating to “Docker for Mac” from Toolbox

As Docker for Mac becomes available, it’s about time to ditch Docker Toolbox which requires a VM running in background. The migration is surprisingly easy. The Official doc recommend you to read this article “Docker for Mac vs. Docker Toolbox“, while I think it’s a pretty good read, I will simply tell you the steps to migrate if you just need the info. Continue reading

Using SoundPool in Android

If your app/game need to play a sound when user click certain object, you will quickly found out that using MediaPlayer is a bad idea. This is what SoundPool is for, however, its API is still a bit unfriendly. This is some notes on how to use it and my suggested usage pattern.

Obtaining a SoundPool object

It is recommended to use the Builder, but lower SDK device does not support that, so this Continue reading

Docker commands to clean unused images

If you use docker for some time, there will be a lot of trash images, volumes that is not used by any containers. Here’s how to remove them. (warning: not reversible)

Remove dangling images

Remove dangling volumes

As seen from above commands, you may guess the nested command within the $(…) is used to list dangling images/volumes

List dangling images

List dangling volumes