Author: jezmck

  • Going Mac – Part 0

    I’ll soon be starting a new job,  still in web development (as I have been for disturbingly more than a decade), though this time it’ll be in-house and for a huge company.

    I’ve been persuaded to go over to what I’ve long considered the dark side; Apple.

    I still don’t believe I’ll ever pay for Apple products with my own money, but it’s becoming clear that Windows really isn’t keeping up with the ease of development on MacOS, and my future employer will be the one stumping up the cash so what’s to lose?

    This is to be the 0th in a series of posts on my conversion, or will that be “enlightenment”? 0th not 1st because I’ve not started yet – I’m just beginning to look at what tools I’ll likely be using.

    Where I spend most of my work days at the moment is in the excellent JetBrains PHPStorm and I’m very pleased to see that I will be able to stick with it. The other software I use is the also excellent FileZilla and the frankly pretty ropey SourceTree. I will likely ditch both and finally get round to instead using the built-in functionality of PHPStorm, and, of course, modern deployment methods.

    I’m a fan of the command line, but it’s always been in *nix (mostly Debian on web servers and Raspberry Pis), so I’m hoping that the move to Apple will mean I can actually do all the modern web dev things instead of spending so much time persuading Windows to let me.

    So far, I’ve used all the contemporary techniques (proper MVC development, proper git usage like branching and pull-requests, npm, gulp, Sass), but never all in one project, and I’m really looking forward to it.

  • WordPress config snippet for dynamic domains

    Quite why this isn’t how WordPress works by default, I’ll probably never know.

    $domain = 'http' . (false ? 's' : '') . '://' . $_SERVER['HTTP_HOST'];
    define( 'WP_SITEURL', $domain );
    define( 'WP_HOME', $domain );

    If anything, this snippet is for my own reference.

    Prevents redirects on development / staging sites without changing the wp-config.php

  • Google Sheets Formula – show an age from a DOB

    I couldn’t find a decent formula to show an age from a Date Of Birth, so I wrote this:

    =CONCAT(FLOOR((TODAY() - B2)/365),CONCAT("y ",CONCAT(FLOOR((((TODAY() - B2)/365) - FLOOR(((TODAY() - B2)/365))) * 12), "m")))

    Shows an age in years and months; e.g. “10y 6m”.

  • Regex to split “){” to two lines, retaining indenting

    I was quite proud to come up with this, so here’s my first blog post for a while:

    Search:
    ^([^\S\n]*)(.+))\s*{

    Replace:
    $1$2)\n$1{

    and as a bonus:
    ^([^\S\n]*)}\s*else\s*{
    $1}\n$1else\n$1{

    NB (2013-09): it seems that the escaping slashes in this post were lost  at some point, I’ve put them back, but not tested!

  • CSS3: Rounded Table Corners (No images)

    You cannot give a whole table (<table>) rounded corners using CSS, browsers will ignore it, you must round the corners of the cells (<td>) inside.

    The following uses CSS2 selectors (:first-child etc) and CSS3’s corner-rounding border-radius to selectively round the outer corners of the cells in the corners.
    This will work for any size table.

    table.rounded-corners tr:first-child td:first-child {
    border-top-left-radius: 5px;
    }
    table.rounded-corners tr:first-child td:last-child {
    border-top-right-radius: 5px;
    }
    table.rounded-corners tr:last-child td:first-child {
    border-bottom-left-radius: 5px;
    }
    table.rounded-corners tr:last-child td:last-child {
    border-bottom-right-radius: 5px;
    }

    And now, in 2025, with overly nested CSS, which ought to be changed to use block and inline rather than top/left/etc.:

    table.rounded-corners {
        tr {
            &:first-child {
                td {
                    &:first-child {
                        border-top-left-radius: 5px;
                    }
    
                    &:last-child {
                        border-top-right-radius: 5px;
                    }
                }
    
                &:last-child {
                    td {
                        &:first-child {
                            border-bottom-left-radius: 5px;
                        }
    
                        &:last-child {
                            border-bottom-right-radius: 5px;
                        }
                    }
                }
            }
        }
    }
  • PHP Bug: json_encode() misleading warning on object with private properties

    I have found a peculiar issue with PHP’s json_encode() function.

    If you have an instance object with private properties and use json_encode() it will give you a very misleading warning.

    class ExampleObject {
        private $privateProperty;
        ...
    }
    $obj = new ExampleObject();
    json_encode($obj);

    results in

    Warning: json_encode() … recursion detected …

    There are two workarounds in the comments for the function at php.net but this is simply a PHP bug as far as I am concerned.

  • 10/GUI


    10gui.com

    This is as much an HCI concept as it is about the GUI.

    I think a multitouch pad would be great.
    5 fingers, i.e. one hand, would be plenty though, and having one hand remaining on the keyboard allows for faster resumption of typing long text.

    My HTPC keyboard already has a simple multi-touch action, two finger to scroll, and I’m sure moving up to five fingers would be perfectly achievable by most users. In fact, in the video above there were only s few times when you’d have to use more than two or three fingers.

    I think this is all fantastically interesting, and discussing the subject with people who won’t just shoot down the unknown/unfamiliar will lead to some great things.

    I wish I could be more involved with this area of research and development.

  • Indian Rupee Symbol Competition

    Since I don’t live in India, I’m not allowed to enter the competition to design an official symbol for the Indian Rupee announced last month.

    I have however come up with a very simple design:Indian Rupee Symbol Design
    (horribly created in Paint.NET)

    I’m posting this now so I can see how it compares with whatever is chosen when the competition closes at the middle of next month.

    This design is easily written by hand, cannot have some mistaken extra meaning when viewed upside-down, and is narrow enough that it could fit in the space for a zero.
    It is also obviously inspired by the letter R.

    I’d also be happy to hear your opinions, positive or otherwise.
    Does it remind you of anything else, does it have meaning in some Arabic script?

  • Recursive Word of the Moment

    vituperate vī-ˈtü-pə-ˌrāt
    verb

    To overwhelm with wordy abuse