1. How to emulate standard front-controller behaviour of routing static assets statically, otherwise calling index.php using the PHP 5.4 built-in server:

    // file: index.php
    // Route static assets from CLI server
    if (PHP_SAPI === 'cli-server') {
        if (file_exists(__DIR__ . $_SERVER['REQUEST_URI']) and !is_dir(__DIR__ . $_SERVER['REQUEST_URI'])) {
            return false;
        }
    }
    
    // do usual front-controller stuff
    
  2. In reply to a post on github.com

    @sandeepshetty @pfefferle cweiske Something new to consider: Jeremy Keith added a webmention sending form to his journal entries to help people who’s websites don’t support webmention already. Being able to test and use webmention through a human visible, interactable form is a huge benefit of using HTTP form encoded data.

    We can make this an even stronger case by encouraging success and error responses to be full HTML documents with helpful copy.

    See also

  3. Watch out for dict-based string interpolation examples which look like this:

    'Hello, %(name)s' % {'name': 'Otter'}
    

    That s after the brackets isn’t pluralising one adorable aquatic mammal into a whole bunch of them, it’s actually part of the interpolation placeholder — the equivalent of

    'Hello, %s' % 'Otter'
    

    Note also that for some reason, python lets you put spaces between the closing bracket and the type signifying character. This can cause extremely weird bugs when the string being interpolated is also being translated. For example:

    _('%(customer) shared a thing') % {'customer': 'Mr. Bean'}
    

    If not translated, this will produce this confusing but fairly easy to debug output

    'Mr. Beanhared a thing'
    

    But if 'shared' is translated into a word beginning with, for example, d, you’ll just get an exception like TypeError: A float is required