about me about me
photography photography
software projects software projects
contact me contact me

I occasionally need the list of method parameter matchers when setting assertions via mocks using with(). A completely useless example:

$foo->expects($this->once())
    ->method('setter')
    ->with($this->isType('string'));

Read the rest of this entry »

Maybe that end part, doesn’t get object oriented design is a bit sensationalist. Don’t get me wrong, I have a lot of respect for Joel. He speaks a lot of sense, his blog and books are testament to that … I own a few of them.

I might be a couple of years late on this … it wasn’t until I was researching an answer to a question on the Stack Exchange Programmers site about test driven design that I stumbled across this blog post by Robert Martin.

So I listened to episode 38 of the StackOverflow podcast, and figured Joel might have said the things he did to stir things up a bit, and light a fire of conversation for the podcast. More Googling lead me to other evidence that he thinks unit testing is a time waster.
Read the rest of this entry »

I originally added this to Wikipedia’s Luhn algorithm page but one of their editors deemed there to be too many language implementations, and so they scrubbed it.

I’m posting it here for other PHP programmers, this might save you a few minutes work.
Read the rest of this entry »

I was surprised to find PDO sqlite support wasn’t included by default with PHP 5 on my Ubuntu (10.04) virtual machine. You can check which drivers are available with this small snippet of code (assuming you run this from the command line):

foreach (PDO::getAvailableDrivers() as $driver) {
    echo $driver . PHP_EOL;
}

Read the rest of this entry »

If you work with git as your version control system and don’t use a GUI app in your workflow, this one liner in your ~/.profile (or ~/.bashrc on Linux) will display the active branch you’re working on when you cd to a git repo path. Read the rest of this entry »

This was just too painful not to blog about. I hope this saves someone else some pain of reading sed documentation to put together a pattern to match C style header comments.

In my case I’m putting together a build script, part of it is to minify Javascript before deployment.
Read the rest of this entry »