Uncategorized

  • JSX is a function call, which explains most of the rules

    JSX looks like a template language embedded in JavaScript, which makes its rules look arbitrary and its errors look like parser bugs. It is not a template language.…

  • natsort for the filenames that sorted in the wrong order

    A directory listing sorted with sort() puts report-10.csv before report-2.csv, because string comparison reads character by character and 1 is less than 2. Nobody reports this as a…

  • Upgrading a PHP 5.3 application to 5.5

    5.3 stops getting security fixes in August. Deprecations first, then the behaviour changes, then the version bump — and an APC replacement that ignores every setting you tuned.

  • assertEquals is loose; assertSame is what you meant

    assertEquals compares with ==, which is PHP’s loose comparison — so a method that has quietly started returning the string “0” where it used to return the integer…

  • Provisioning a development box instead of installing one

    Three developers, three PHP patch versions and a bug that existed on one of them. A Vagrantfile, a playbook for everything inside it, and what the rebuild costs.

  • The virtual DOM is a diff, not a speed trick

    The claim that React is fast because of the virtual DOM has the causation backwards. Rendering a component tree into a JavaScript object graph and diffing it against…

  • Media query order decides which override wins

    A media query adds no specificity. A rule inside @media (min-width: 768px) and the same selector outside it carry exactly the same weight, so the winner is whichever…

  • Detach a node before a heavy DOM edit, then put it back

    Appending 400 rows to a table one at a time makes the browser invalidate layout after each insertion, because each one changes a tree that is still being…

  • A null object removes the if you keep writing

    An optional collaborator — a logger only configured in production, a cache that may be switched off, a discount that may not apply — produces the same three…

  • A TIMESTAMP column has a default you did not ask for

    shipped_at TIMESTAMP in a migration and the column that ends up in the database are not the same column. MySQL applies two implicit rules to the first TIMESTAMP…