Tricks on the Block

I learned a trick about writing more _todo methods or names that I can figure out later and not waste time thinking on what name to put. So after a while whenever I am ready for a mass renaming I do issue this command to search though and change/update them:

~ grep -Rin todo ./src/

Also I am trying to replicate
git branch -vv
git log –oneline base..dest | wc -l
gitk –date-order –all

Githug and Git Achievements are complementary

I have just kind of finished testing githug and git achievements. I believe both tools are useful. One tracks all your git commands that you do throughout the day and the other actually constraints you to work into one directory where you will find git challenges and it at the end prompts you to create your own level which is the interesting part. That of course one can do when one has at least a pretty good level in git. I wonder if there can be a tool like this but able to teach github commands or other. It is interesting how this although it does not replace the theory it does a good deal in the practice and testing side. It teaches by challenging you. I recommend taking a look at both.

What would be a good level to create for PR’eing advanced example or other task like that?

When Your Mate Deletes Your Files On A Common Project

What happens when your friend removes some of your files because he thought it was not needed and then you want to rebase and it is gone. There are several ways to recover the file, by going to github and checking on its history, but here I will present two methods of how to do this. The first one is via a log command and the second is via a rev-list command.

git log --pretty=oneline -- <file_path> | tac

This way we reverse the output of a git log regarding the file in question. But now let’s look at a more interesting way:

git rev-list -n 1 HEAD -- <file_path>
git checkout <deleting_commit>^ -- <file_path>
// or in one command
git checkout $(git rev-list -n 1 HEAD -- "$file")^ -- "$file"

source: http://stackoverflow.com/questions/953481/restore-a-deleted-file-in-a-git-repo
In case you also want to review more than one commit you can vary the 1 above to include more commits that have to do with the file in question.

PHPStorm aid to autocomplete with Symfony2 etc

I have read today a ticket in which there are some struggling with PHPStorm even the 4 EAP version to autocomplete some FQCNs methods etc.
The trick has long been lived in the community and is doing just the following:

/**
 * @var $myProperty \Behat\Mink\Behat\Mink\Session
 **/
$myProperty->getCertainMethod();

It could be tedious and you could blame one or the other but it seems it was a convention. The idea of why the docblock is like that comes from a practice of just conveying the class information that the parameter is relying on. Until PHPStorm adopts this or you change completely the symfony2 standard then someone would keep on bearing this.