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

Docker named volume explained

Named volume is a new feature since Docker 1.9, it allows you to manage persistent data more easily, and also the volume can be provided by other storage drivers such as Glusterfs instead of “just a directory on the host”. This new feature is particularly useful in production environment. (On the Dev side, I think we still need mounted volume) Continue reading

PHP Traits – why is it useful

I know I’m late into the game but I recently found that Traits in PHP is really useful. PHP Traits come in handy if you have some part of a class you wish to re-use in the future in another class, but you don’t want strict inheritance relationship.

What is Traits

PHP Trait defines a code segment that is simply copy-n-pasted into a class at compile time. It can contains variables, constants, methods, Continue reading

WordPress command line interface (WP-CLI) guide

WP-CLI is a tool for managing your WordPress website via the command line. This may come in handy if you want to manage your WP instance without going through the web interface, or automate certain operations (change of Settings, perform backup etc.)

For example, here is a sequence of commands for installing a fresh copy of wordpress:

Continue reading

Javascript simple floating and forever moving image

In this example, I will show you how to  animate an element and make it moving up and down infinitely. And I will do it without any explicit Loop construct (no for, while loops), with the help of the jQuery.

HTML:

Javascript

 How it works

In CSS, we set the element (the IMG) to absolute position so that it “float up” and detach from the normal layout. With this, we can move the image up and down by changing the “top” CSS property.

In Javascript, we define two functions, bannerMoveDown() and bannerMoveUp(). In each function, we use the jQuery animate() method to animate the IMG element, and after the each animation ends, we call the other one respectively, thus making it loop forever.

Finally, we call bannerMoveDown() to initiate the animation loop.

Fully functional example

Please checkout a fully function example here on JSFiddle: http://jsfiddle.net/madcoda/mN3n8/

Thanks for reading, Leave your comments down below if you encounter any problem!

Solving Genymotion “unable to connect to your virtual device” Error

So I know you are here because you get this error message while starting a Genymotion Device.

genymotion_1

First you should go check your firewall settings as suggested in the Genymotion FAQ. Other than that, if the problem still persist, 9/10 it’s the problem of your Host-only adapter settings. Here’s how to correctly set it. Continue reading