May 11, 2013

Custom RecursiveIterator

PHP RecursiveIterator and its relatives are quite handy in any tree-related situation. Probably the most used is RecursiveDirectoryIterator for getting all files recursively in a directory. But this family of iterators has some issues to be addressed so that developers do not end up fleeing. First, you must not fear SPL. But there's more. Let's see…

Keep empty directories in git: The VERY easy way

I keep hearing this question over and over in the internets: How do I keep an empty directory in git?
And they're usually followed by a hundred of different answers, mostly "you can't" and very complicated ones.
But, in fact, there is a way that's pretty EASY: