CSS Tips

This on r/programming today: CSS Tips. There are a lot of good tricks in there, this one was my fav:

.center {
  display: flex;
  align-items: center;
  justify-content: center;       

…it centres content vertically and horizontally.

PHP finally blocks not run on exit

I confirmed with the following code that if you call ‘exit’ withing a ‘try’ block the ‘finally’ block does *not* execute. That’s probably what you would expect. But now we know.

register_shutdown_function( 'handle_shutdown' );

try {


catch ( Exception $ex ) {

  echo "caught...\n";

finally {

  echo "finally...\n";


function handle_shutdown() {

  echo "shutdown...\n";


“REST” interfaces

I just wanted to get something that I’ve thought for many years on record, because I don’t think I’ve ever had the chance to discuss it much before, but I believe JSON web services (“REST APIs”) and web applications should deal only in two HTTP verbs, being: GET and POST. You use GET for queries and you use POST for submissions. All POST operations go through business logic for particular services and CRUDing URLs is a supremely bad idea, in my opinion. Just wanted to get that on record. Thanks. p.s for web applications you should 3xx on success, not 2xx on success; what you do for JSON web services is up to you, but for those 2xx is probably fine.