Category Archives: Computers

Ordinarily, overflow: hidden; on the body tag is sufficient to prevent scrolling a web page, if for instance you’re creating a drawer to hold content that will scroll separately. However, this doesn’t work in iOS6. The best I’ve come up with so far is to set position: fixed:

Extend Laravel’s validator class to fully validate dates in the format (DD/MM/YY). Tested in laravel 3.
public function validate_uk_date($attribute, $value, $parameters)
{
/*
Validates a UK date to fit DD/MM/YY, checking for days in the month and accounting for leap years.
Laravel's date validator didn't seem to do that.
*/

One of those hard lessons today that takes way longer to learn than it should. wp_editor() generated TinyMCE boxes were looking awful when used in a template I’m developing, and I couldn’t see why. Turns out the WordPress editor does not work with box-sizing: border-box. It was turned on in a recent addition to the excellent bones starter theme.

While looking into the course of kernel panics on my iMac, I found that two kexts relating to Avatron’s Air Display were in /System/Library/Extensions, despite the fact that I uninstalled Air Display using their bundled uninstaller a bit back. The two offending files are AVVideoCard.kext and AVFrameBuffer.kext. Simply moving them outside of the Extensions folder and rebooting is enough to get rid of them, and there doesn’t seem to be any ill effects.

I very quickly (and badly) hacked up Zahlan’s excellent Categories Images plugin to save image IDs rather than the absolute URL to the image file. This means we can use WordPress’ image resizing as well as its other image meta tools.

Update (10 Oct 12): The first upload had a bit of code left in from my own use of the plugin that limited it to a certain taxonomy. I’ve removed it now so the plugin works on all taxonomies as it should.

The key points are:

z_edit_taxonomy_field() and z_add_taxonomy_field() are modified to have a separate button to upload the image rather than clicking the text box. It means the user can manually type the ID if they wish.

z_script() grabs the image ID from thickbox instead of the URL. Because thickbox returns an img tag with the image, the only way to get the ID is to chop it out of the class.

z_save_taxonomy_image() validates the image ID before saving in case the user types an ID in the text box.