Easily install local NPM packages by simply referring to their local path

Directly installing a package with npm install and referring to its local path is a quick way to work with a local package. To be safe though, the usage of npm link is still recommended. The npm link way To work with local NPM packages on can reside to using npm link. You make a …

Convert between Symfony HttpFoundation Request / Response and Swoole Request / Response classes with swoole-http-message-bridge

Today I was implementing an HTTP Server using Swoole. At its core, the code looks just like the Swoole HTTP Server example: <?php $http = new \Swoole\HTTP\Server("127.0.0.1", 9501); $http->on('request', function (\Swoole\HTTP\Request $request, \Swoole\HTTP\Response $response) { // … $response->end(); }); $http->start(); In that same project I was also looking to use a package that evolves around …

CSS :nth-of-class selector

The Problem One thing that bothers me with CSS :nth-of-type/:nth-child selectors is that you can’t combine them with CSS classes. The selector below for example won’t work as you’d first expect it to work: .bar:nth-child(2) { color: red; } No, the selector above won’t color the second .bar element red, something I had somehow expected …

Going Serverless with Google Cloud Run

Recently I was invited as a speaker to Full Stack Ghent and PHP-WVL. At both events I brought a new talk called “Going Serverless with Google Cloud Run”. Cloud Run is a fully managed compute platform by Google that automatically scales stateless containers. By abstracting away all infrastructure management, us developers can focus on what …

ESNext: Get localized language, currency, and region names with Intl.DisplayNames

An ECMAScript Internationalization API Feature that currently is in Stage-3 and that has already landed in V8 version 8.1 is Intl.DisplayNames. It’s a way to get localized display names for languages, scripts, regions and others. The idea is that you as a developer should not build your own list of localized strings for languages, regions, …

You don’t need webpack / Rollup / Babel / whatever to start with React

A common misconception about React is that you need to set up an entire toolchain to get started with it. While that might have been true in the past, that certainly isn’t the case today. From the React Docs: The majority of websites aren’t, and don’t need to be, single-page apps. With a few lines …

Cloud Run Button: Deploy Docker Images from Public Repositories to Google Cloud Run with a Single Click

If you have a public repository with a Dockerfile you can have users automatically deploy the container to Google Cloud Run by adding a Cloud Run Button. It’s no more than an image that links to https://deploy.cloud.run, like so: [![Run on Google Cloud](https://deploy.cloud.run/button.svg)](https://deploy.cloud.run) Add that code to your README.md and when a visitor follows that …

Fixing ab (ApacheBench) Error "apr_socket_connect(): Invalid argument (22)"

Note to self: when running ApacheBench it does not know how to resolve localhost. Instead you’ll have to use 127.0.0.1. I seem to forget this every single time I use it 🤦‍♂️ ~ Won’t work: localhost $ ab -n 5000 -c 50 http://localhost:8080/ This is ApacheBench, Version 2.3 <$Revision: 1843412 $> Copyright 1996 Adam Twiss, …

Beware when base64-encoding on the CLI using echo

Recently I needed to base64-encode a string. To do this I turned to the CLI and piped the output of echo to base64. # Don’t use! Correct command further down this post. $ echo ‘test’ | base64 dGVzdAo= Although the output looks quite good, things didn’t quite work out when using the string: it failed …