Archive
Shell Line Count
I found this useful page for counting lines in projects that I work on.
There are a couple of different techniques there, but I personally use the following:
find . -type f -name '*.php' | xargs wc -l
Filesize Formats
This handy function allows you to pass a filesize in bytes and have it returned with the appropriate suffix.
Credit is due, but I don’t remember where I originally found it (possibly the PHP documentation site).
Country Array
Here is an easy to use function to allow you to display a list of countries to your users – this avoids them having to type it out (potentially incorrectly), and is ideal for use in a select field (drop-down box).
As an added bonus, you can also download a collection of flag images, with each image filename renamed to match the corresponding array key. The original images can be found at famfamfam.
Developing with Bazaar
I’ve been using Bazaar VCS for some time now, perhaps half a year or so, and have come to love it for its simplicity but also its flexibility.
In this article I’m going to outline the process of setting up a project repository with Bazaar and then using it alongside development.
Wildcard VirtualHosts (Mac OS X 10.5)
I spent a good hour or so trying to get wildcard VirtualHosts working on my Mac – here I’m going to outline the steps I took, as information on the web was very sparse.
