Category Archives: Code Stuff
Hanging server? Log the output of top to a file
I have a server that will randomly slow to a creep and then become completely unresponsive, requiring a remote reboot. I’ve looked at every single log file and not found anything useful so I came up with the following bash … Continue reading
PHP function to generate a slug for SEO URLs
Increase SEO by using your article name/product name/category name/whatever in your URLs instead of a non-descriptive database ID.
Force SSL by loading the same page via HTTPS
Just a simple one, I place this in a common file, and then call it at the top of each page that I require to be secured by SSL.
MySQL string escaping in PHP
Simple function to prepare user inputted data for inserting into a MySQL database. It simply checks if stripslashes() should be called, and then escapes the string. Basic, but handy.
The most useful PHP function you’ll ever use!
This is the first thing I add to any PHP based project and I couldn’t live without it.. Most people will probably understand and appreciate what this does, but for those that don’t, it simply displays the contents of an … Continue reading
Bash alias to search file contents
This simple Bash alias will search the contents of every file in the current directory (and sub-directories) and return the file names. Very handy when trying to work out which file generated which HTML in large PHP based applications or … Continue reading
My config files
For those that are interested and for my own reference…


Stalk me...