Star Wars Rogue One Trailer (vs. Beastie Boys)

This actually works 🙂

Elsewhere , Leave a comment

Context aware MySQL pools via HAProxy

At GitHub they use MySQL as their main datastore. The setup is a typical “single-writer-multiple-readers” design. They loadbalance between server pools using HAProxy, with some cleverness built in:

Instead [of checking whether a MySQL server is live with mysql-check], we make our HAProxy pools context aware. We let the backend MySQL hosts make an informed decision: “should I be included in a pool or should I not?”

The HAProxy config contains all known hosts. The hosts themselves can answer to checks running with either HTTP 200 (OK), HTTP 503 (Not OK), or HTTP 404 (Maintenance). Based upon those answers HAProxy will assess if there are enough hosts in the main mysql_ro_main pool to handle the load, and automatically switch to the failover mysql_ro_backup pool if need be.

frontend mysql_ro
  ...
  acl mysql_not_enough_capacity nbsrv(mysql_ro_main) lt 3
  use_backend mysql_ro_backup if mysql_not_enough_capacity
  default_backend mysql_ro_main

Clever.

As an extra, they’ve also integrated it all into their chatops.

github-mysql-haproxy-chatops

Context aware MySQL pools via HAProxy →

Elsewhere , , , Leave a comment

Static Map Maker

static-map-maker

Static Map Maker is a tool to easily create static map images from services such as Google Maps, Bing Maps, CartoDB, MapBox, etc. Just type in the location, flip some switches, and get the URL you need.

Static Map Maker →

Elsewhere , Leave a comment

30K Page Views for $0.21: A Serverless Story

Pete built the Fantasy Movie League Lineup Calculator. In July it got about 30K pageviews, resulting in a $0.21 bill from Amazon AWS:

The Lineup Calculator is comprised of a set of AWS Lambda functions. Boiling what I’ve done down to its essentials, I’m using Lambda as a free batch server where I’m well below the free tier of 1M transactions per month and using S3 as a low cost web host where my primary cost is the egress.

At work we’re also heavy AWS users. Some of our projects – like the haroon.be meme generator – run using a likewise setup: static (and generated) files are stored on S3, with some Lambda sprinkled on top.

30K Page Views for $0.21: A Serverless Story →

Elsewhere , , Leave a comment

The most dangerous person in Silicon Valley

No, not The Drive-By Manager but (those who claim to be) The Senior Software Engineer:

There are lots of people with the title but not the skills. They are hard to spot because they’re definitely not junior but they’re not really senior either. They’re mid-level engineers who have been convinced they’re senior by the ecosystem.

Love that end part: “[They] have been convinced they’re senior by the ecosystem”. Startup title inflation.

The most dangerous person in Silicon Valley →

Elsewhere , Leave a comment

You don’t need JavaScript

css-custom-checkboxes

CSS is powerful, you can do a lot of things without JavaScript.

A quite commonly known example is usage of the Adjancent Sibling Selector (viz. +) to build custom radio buttons/checkboxes or tab interfaces.

With a few more CSS tricks such as the :target/…/:active/:checked pseudo-classes, the ::after/::before pseudo-elements, and the attr() CSS function one can achieve some other great effects:

You don’t need JavaScript is a repo that aggregates many of these “Pure CSS” Solutions.

You don’t need JavaScript →

Elsewhere , , Leave a comment

Improving readability using array_filter

php-logo

Great trick by Freek Van der Herten: instead of selectively adding fields onto an array after having verified them to not being falsy – resulting in lots of if blocks in the code – it’s actually a lot easier/readable to fill the array first and then successively filter out the empty values using array_filter.

When that function is called without a second argument it will remove any element that contains a falsy value.

class Address
{
    ...

    public function toArray()
    {
        return array_filter([
            'name' => $this->name,
            'street' => $this->street,
            'line2' => $this->line2,
            'busNumber' => $this->busNumber,
            'location' => $this->location,
            'country' => $this->country,
        ]);
    }
}

In case that – for example – $this->busNumber had a value of null in the example above, it would be omitted from the returned array.

Improving readability using array_filter

Elsewhere , Leave a comment

Visualising all Olympic 100-meter dash winners since 1896

Great visualisation by The New York Times:

How does Bolt compare to the full Olympic field in the 100-meter dash – not just this year, but against every Olympic medalist since 1896? To answer that question, we created a massive (and imaginary) track with 88 lanes – one for every medal awarded in the 100-meter dash in the modern Olympics.

final_image1_top

Yes, that’s Bolt there in the down right corner. What I find peculiar is that the finish times seem to improve in jumps (and now seem to have stabilized). For example: what happened in 1932 that resulted in a huge improvement? Also take a look at 1984 and you’ll see Carl Lewis – of whom its known that he has taken illegal substances – finish way before all other contestants.

More visualisations in the article itself.

Usain Bolt and the Fastest Men in the World Since 1896 – on the Same Track →

Elsewhere , , Leave a comment

React Storybook – Isolate your React UI Component development from the main app

react_storybook_screenshot

With React Storybook, you can develop and design UI components outside your app in an isolated environment. It will change how you develop UI components.

Oh, it also plays nice with create-react-app.

React Storybook →
Introducing React Storybook →
React Storybooks meets Create React App →

Elsewhere , , Leave a comment

Is Houdini ready yet‽

css-houdini

“Is Houdini ready yet‽” is a dedicated page to tracking the status of Houdini.

But what is Houdini? Here’s a snippet from Smashing Magazine:

Imagine how much nicer your development life would be if you could use any CSS property and know for sure it was going to work, exactly the same, in every browser. And think about all of the new features you read of in blog posts or hear about at conferences and meetups — things like CSS grids, CSS snap points and sticky positioning. Imagine if you could use all of them today and in a way that was as performant as native CSS features. And all you’d need to do is grab the code from GitHub.

This is the dream of Houdini.

But how?

The Houdini task force has introduced several new specifications that will give developers access to all parts – instead of just the DOM/CSSOM part – of the rendering pipeline. The chart below shows the pipeline and which new specifications can be used to modify which steps.

05-spec-coverage-opt

With Houdini’s APIs one could – for example – implement the Masonry or Grid Layouts, running them at native speed instead of as a script/polyfill:

body {
  display: layout('masonry');
}

Is Houdini ready yet‽ →
Houdini: Maybe The Most Exciting Development In CSS You’ve Never Heard Of →

Elsewhere , , , Leave a comment