Update or Export WordPress with Ruby and Thor

rob 12 Nov 2011
Comments Off

I may be a devout rubyist, but I still have a soft spot for WordPress — and maybe even a little for PHP too. One of the things I think is lacking is a good way to manage WordPress updates since, as we all know, WordPress updates constantly. I wrote this quick thor script to help me update to the latest version from the command line so I can do quick version testing. As an added bonus, there is also an export task as well which will simulate doing a wordpress XML export from the dashboard.

So, for all you WordPress guys out there who hate doing manual updates, check this out. It may make life a little bit easier.

More →


Logging in PHP

rob 09 May 2011
Comments Off

There are tons of PHP logging apps out there, but here is my take on it. This is a simple drop-in class that is 1 file and is pretty flexible. In my opinion this is about all that is required of a PHP logging class, and its been working out well for me.

More →


PHP 5.3.3 MySQLi compile woes: my_global.h and error: duplicate ‘unsigned’

rob 08 Oct 2010
Comments Off

It seems like every time I re-compile PHP I get some whacky error. Anyway, I was fortunate enough that a quick Googling found a solution from katmai for compile error.

I’m popping this up here as a reminder to my future self, as well as anyone else who stumbles into this.

If you get this error when attempting to compile PHP 5.3.3 with MySQLi on, in my case, Snow Leopard

/usr/local/include/mysql/my_global.h:1008: error: duplicate ‘unsigned’
/usr/local/include/mysql/my_global.h:1008: warning: useless type name in empty declaration

Was solved with a simple patch to ext/mysqli/php_mysqli_structs.h

More →


Hacking PHP: Be careful with header redirects

Something I’ve noticed a lot with PHP developers is how they handle session checking for users. Most people use a simple $_SESSION['...'] check and if that fails they use a header('location:...') redirect. I’ve also noticed that a lot of those same developers miss one key security flaw: not everything respects headers. Here is a small example using cURL to demonstrate what I mean.

More →


Dead Simple PHP Template Rendering

rob 29 Mar 2010
Comments Off

Ever want to break a small PHP app into an MVC-ish convention without the need of tacking on a massive templating engine? Are you opposed to remembering new syntax just for a template? Why not just use some ob_* code to roll your own simple templating engine?

This will allow you to create PHP includes which will render as templates so you can organize your app into an MVC-ish layout.

More →


Fuzzy Dates in PHP

rob 24 Mar 2010
Comments Off

Ever need to provide a fuzzy date using PHP for your web app? Heres a simple snippet that will do just that.

More →