Quick Lists in PhpStorm


Quick List are an awesome way to improve the way you code inside PhpStorm.

They allow you to prevent one of the things that slows down any person that uses the keyboard… “the mouse”.

By creating a custom simple context menu that you can call using a key a shortcut key from the editor is a really nice feature.

Let’s see how can we do this.

First we need to go into PhpStorm Preferences/Settings and in the search, just type “quick” (1).

Preferences Window - Quick List

Preferences Window – Quick List

After you typing you get automaticly the Quick List “QL” panel on the right, that is divided into: The list of QL’s available (2) and the list of items for each QL (3).

By pressing the plus button (4) you can create a new QL. Just press it.

You can see in that a new “unnamed” QL appeard. Change the name for something like “Really Fast List” (5), give a description if you want. After that press the second plus button (6) to start adding new QL items.

Preferences Window - Quick List

Preferences Window – Quick List

When the “Add Actions to Quick List” popup opens, just type something like “reformat” (7). Choose “Reformat Code…”, and press OK.

Add Actions to Quick List

Add Actions to Quick List

Now you can see that you have a new item in the QL called “Reformat Code…” (8). Try adding others.

Preferences Window - Quick List

Preferences Window – Quick List

I’m going to add 2 more. One is “External Tool” that I’ve created for running the “Symfony Assetic Dump” (9), and the other one is the “Git Pull” (10).

Add Actions to Quick List

Add Actions to Quick List

In the Preferences window your going to get something similar to this (11):

Preferences Window - Quick List

Preferences Window – Quick List

Hit Apply, and in the top left search, write “keymap” (12), and on the right type “really fast” (13), and you can see the QL “Really Fast List” that we created some seconds ago. Now we just need to add a shortcut to it. Right click on the list and choose “Add Keyboard Shortcut” (14).

Preferences Window - Keymap

Preferences Window – Keymap


Preferences Window - Keymap

Preferences Window – Keymap

Choose a shortcut that is easy for you to rembember. For this example im using “Option + CMD + X” (15). Phpstorm will give you warnings if the shortcut is already being used. When no warnings press OK, and OK again in the Preferences window.

Enter Keyboard Shortcut

Enter Keyboard Shortcut

Now for testing, just any file on the editor, and press the shortcuts that you just assign to our QL and You can now see a small QL in our editor (16), only with items that we choose. Choose one of the items (in my case i choose Symfony Assetic Dump) and i can see the result on my console (17).




Phpstorm Console

Phpstorm Console

This is something really simple to setup, and very helpfull.


Add MySQL function DATE_FORMAT to Symfony Doctrine DQL


To add MySQL function DATE_FORMAT() to Symfony Doctrine DQL, just create a file src\Acme\AcmeBundle\DQL\DateFormatFunction.php with:

and in your config.yml you can add:

and now you can use it like this:

Set JDK enviroment path in Fedora

After installing PHPStorm in Fedora 20, I was trying to run it for the first time and getting this error:

To solve this you need to edit ~/.bashrc

and add the following line.

Use PhpStorm External Tools


PhpStorm is an awesome IDE.

One of the it’s features is the ability define External Tools and call them when needed.

The examples that I’m going to show in here is using the command line for calling some Symfony Framework App Console commands, but you can choose anything.


Mac Preferences Window

Mac Preferences


With PhpStorm open, go to PhpStorm > Preferences menu (mac) File > Settings (win) and in the window that popups, search and click on External Tools on the left side.






on Mac

on Mac


On the bottom right (mac) top right (win), you can see some buttons, click on the plus



on Mac

on Mac


A window popups with some command configuration stuff to add.


on Mac

on Mac






All the items in the popup are pretty self explanatory, so we are going to try to fill some of them.

After this we can click OK, and close the preferences window.


on Mac

on Mac







Now if you take a look at the Tools menu you might have something like this.


on Mac

on Mac


If you click on PHP Version, the terminal window will open and show you something like this.





This is a very simple example, but you can start being very creative with these commands. For example people who use Symfony2 many times have to clear the app/console cache or other stuff, so let’s going to create some shortcut’s.

on Mac

app/console clear cache on Mac

on Mac

doctrine update on Mac


Get creative :)


Prevent date_default_timezone_get() warning in Symfony2



For those who had this kind of problem when using Symfony2:

just add this to app/AppKernel.php

Unity 3D C# script for continuous rotation


Just some basic script for continuous rotation in Unity3D, with some simple params.

Also available on gists: https://gist.github.com/Narven/0e3c355f5ae675c2a352

jQuery prepend, append, before, after


One of the most used methods (at least for me) are prepend, append, after, before

They allow to add html to specific areas.


Imagine that we have something like this list:

If we need to add a new list item ‘Item 0′ at the beginning, we can do it by using “prepend()”


Append works the same way, but adds to the end of the list


Image that you want to add a item to the list, before the the last item:


Image that you want to add a item to the list, before the the last item:


Vagrant, no more MAMP?


Vagrant, what is it?

Vagrant is a command line manager for VM (Virtual Machines). Vagrant allows developers to create and manage virtual machines using the command line, and most important of all, allows developers to specific say what they what to be included in that VM.

Vagrant was created by Mitchell Hashimoto (@mitchellh).

You can think of Vagrant as a “Virtual Machine Configurator and Manager”. Image that you go to a website and you can customise the car that you want to buy. You can choose the interior/exterior colours, type of engine, etc. This is what Vagrant does for you. You specify what you want to be included in the VM and Vagrant handles the rest.

That previous example was a little bit weird for a developer. Let me try to explain in another way. How many times, you had to setup one host so that you can work on a project? How much of that environment resembles the final production server where that project is going to be deployed? Probably you know that it uses LAMP, and you just fire up MAMP, and start coding.

How cool it would be that you could have an environment equal to the production server? With Vagrant you can. Just tell what you need and Vagrant creates that environment (VM) for you.

How to get started?

First of all you need to have install VirtualBox.

Then you need to download and install Vagrant. Just click the latest version, and choose the correct file for your OS.

After downloading and installing Vagrant you just need to create an empty directory for your project. And inside of it run the command:

and you get something like this:

A Vagrantfile has been placed in this directory. You are now

ready to vagrant up your first virtual environment! Please read

the comments in the Vagrantfile as well as documentation on vagrantup.com for more information on using Vagrant.

if you try listing the directory you get something like this:

This creates a simple .vagrant directory, and a Vagrantfile. This Vagrantfile is where we specify all of our configurations and specifications.

The Vagrantfile looks something like this:

NOTE: I’ve removed most of the comments in the file.

Now if we run the command:

you get something like this:

This make take a while, but only for the first time. You can change and update all the configuration and run the command:

and Vagrant will update the VM to the specified changes.

Soo now we have a VM at our disposal. Just run the command:

and we get something like this:


now we are inside a Linux VM.


Vagrant works with something called a “box”. What is a “box”?

Well a box, is a pre-made VM (bootstrap) for the VM that you want to build and customise. So every VM that you want create/modify to your needs, starts with another “clean” VM.

In this default example, since we did not specified any box, Vagrant uses a Linux Ubuntu box called lucid32. There are a lot of box’s that we can specify that we want to be our base box. Please check this link (http://www.vagrantbox.es/)for more information about it.

If we take a look at our Vagrantfile we have this line where we can specify the url of the bootstrap box that we want:

just change it to something like:

By making this simple change, instead of using the Linux Ubuntu Lucid32, we are using, CentOS 6.2 32bit (with puppet).

The Vagrantfile is very simple and easy to understand. For more information, please take a look at the documentation.


Vagrant has a lot of more configurations and providers (Puppet, Chef, etc) that help to configure everything that you want to be installed in the VM. And has the main ability, that you can share the Vagrantfile with team developer and he will get the same VM to work.

I’ll be posting some more information soon explaining how can you achieve your perfect VM.