Debian Squeeze comes with PHP 5.3. This is good, because PHP 5.2 is no longer maintained, but causes problems for old applications that can’t support it (e.g. ViArt 3, because it uses Zend Encoder). Rather than permanently downgrade PHP for the whole server,…
WordPress stores the site URL in the database by default (which I have never understood), and its a pain to have to type out the UPDATE SQL or search in phpMyAdmin to change it. This is a simple way to…
Every now and then you need to work out if a script is running in Cygwin…
These are a few examples from my AutoHotkey script that run various programs when you press certain keyboard shortcuts. Add as many of these as you want to a .ahk file, and set that to be run at startup.
This is part of my AutoHotkey script that turns off my monitor when I press Win+\. It also turns the screensaver on at the same time, so that Windows Live Messenger (and any other programs) know I am away.
This is part of my AutoHotkey script that puts my computer to sleep when I press Win+F12.
This is part of my AutoHotkey script that pastes the current date into any program when I press Ctrl+Alt+Shift+D.
This is a very simple function to convert a user-supplied URL to just the domain name.
There are three options (that I know of) for automatically enabling a plugin in new sites.
When you create a new WordPress Multisite blog from the admin area, you have to enter three things: Site address (subdomain or folder name), Site title and Admin email…
I used this code snippet as part of a WordPress Multisite plugin, to allow me to quickly set some options for all blogs in the network.
This code was used to generate a menu showing all blogs on a WordPress Multisite installation.
The WordPress function the_category() doesnt work particularly well when you have hierarchical categories.
I used this code to automatically set the default post title, category and tags for a new WordPress post based on which link was clicked.
On one WordPress blog I have categories for “Starred” and “Archived”, in addition to the real categories. I hacked this together to make sure the posts would still go into Uncategorised as well.
This is a follow-up to Toggle “Starred” Category in WordPress – making it more generic and usable for multiple categories.
Even if you disable all but one theme, WordPress seems to default to TwentyTen when creating a new Multisite blog. The fix is simple though – add this to wp-config.php.
I did this simple hack on a private WordPress Multisite blog, to stop it sending me emails every time I created a new blog. It’s definitely overkill to stop all emails, but unfortunately I couldn’t find any hooks that let…
Filosofo Comments Preview is a WordPress plugin that lets you preview comments on your blog before you submit them. In the current version (1.5) it doesnt increment the number of posts, so it still says there are no comments when you…
This is a modification to the theme’s functions.php that adds a widget to list all of the posts in the “Starred” category.
This redirects to the post/page itself after publishing or updating a post in WordPress.
How to add a simple “star” flag to posts (a la Gmail).
I have decided to split up PHP Mate, my “general-purpose” PHP library, into several smaller libraries…
How to detect whether input is from keyboard, a file, or another process. Useful for writing a script that can read from standard input, or prompt the user for input if there is none.