shortcuts for developers i have added to my daily workflow

As a developer i switch between different Applications hundreds of times a day, therefore i had to optimize this ;). I am only sharing the most useful here, with the shortcuts i list here i personaly do not need CMD + TAB anymore.

In order to achieve this i use:

Applications i use litteraly all the time:

General shortcuts:

shortcut what it does
CMD + . will always toogle iTerm 2 no matter in which application i am.
CMD + F16 will open or switch to Safari which is my main browser
CMD + F17 will open or switch to WebStorm
CMD + F18 will open or switch to PhpStorm
CMD + F19 will open or switch to Paw

Application specific shortcuts:

I consider Keys F12,F13,F14 as application specific, therefore i re-use those multiple times. I am not showing those here as they are often code related like console.log(), var_dump()

iTerms:

As a heavy Docker user i needed shortcuts to the most important functions. These save me a lot of time every day.

shortcut what it does
CMD + F13 will type copy selected text and then paste as docker exec -it e4d509399a4a bash
CMD + F14 will type copy selected text and then paste as docker logs -f e4d509399a4a
CMD + F15 will paste docker ps

PhpStorm

Most of the time i code REST Api’s therefore the 2 main tools i use is PhpStorm and Paw, i switch hundreds of time between those 2 Apps. These Toggles are also very handy if you use „Split Screen“ in MacOS

shortcut what it does
CMD + 0 will switch to Paw if i am in PhpStorm or will switch to PhpStorm if i ma in Paw.

WebStorm

Sometimes i also do Frontend or Ionic work, therfore i this toggle.

shortcut what it does
CMD + 0 will switch to Chrome if i am in WebStorm or will switch to Webstorm if i ma in Chrome.

How i sync my code automatically to a remote server

I do not want to have my Docker setup on my Mac for several reasons. Docker on Mac sucks because of volumes. I could use Docker-Machine but i don’t like the idea of having a virtual machine running just for that.

That is why i have my docker setup running on a powerful server in the cloud.

As soon as the code changes it want all the changes to be automaticaly synced to my server.

But how the get code changes there ?

Because MacOs is awesome you can achieve this with included tools such as rsync and lauchd.

Here are my settings, please adapt it to your needs.

First of i have created a simple bash file which takes care of calling the actual rsync command. This fits my needs as a PHP/Symfony Developer but you can easily adapt it to your needs.

Please checkout my gist on github to get the code.

Put the file to ~/sync.sh

You can call it like below but first you have to replace some placeholder with your variables

– my_user=your username on the remote server
– my_remote_host=the hostname of your destination server
– my_source_folder=this is the local folder where your code resides
– my_remote_folder=this is he remote folder where the code gets synced to
– my_project_folder_to_monitor=this is the local folder where your code resides (should be the same as my_source_folder)

/bin/sh -c "~/sync.sh -h my_remote_host -u my_user -s my_source_folder -d my_remote_folder"

Okay, that is already pretty good. But i wanted to run this script as soon as code changes in my project. To do this i created a job for the laund on my mac.

Please checkout my gist on github to get the code and create a file called my_sync_job.plist in ~/Library/LaunchAgents Of course you will need to adapt the placeholder as described before.

Now we can Load the Job by doing this.

launchctl load '~/Library/LaunchAgents/my_sync_job.plist'

Now if you did all correct you can try to make a change in any file in your project folder and i will get synced to the remote server.

You can unload it by doing this

launchctl unload '~/Library/LaunchAgents/my_sync_job.plist'

You could to some more fancy stuff with these tools so be creative 😉

Zf2 Doctrine2 working skeleton application

I wanted to try out Doctrine 2 in Zf2 so i started googling. I have found a lot of examples, skeletons and suggestions but none of them worked 100% for me so i decided to create my own skeleton based on what i have learned so far.

Check out my new ZF2 Doctrine skeleton Application on Github.

https://github.com/sseidenthal/Zf2Doctrine2-Skeleton