Grid Time (or “Why are clocks in Europe lagging behind by 5 minutes?”)

Yesterday I heard on the news that clocks in Europe have started to lag behind on the official time. The culprit is a fluctuation in Europe’s electricity grid. Clocks, like the ones in your microwave, that are reliant on Grid Time are affected by these fluctuations:

Grid Time is a time measurement which is based on the standard grid frequency of 50Hz in Europe. Fifty oscillations in alternating current equate to one second of grid time. Frequency fluctuations lead to deviations in grid time. If the frequency is lower than 50Hz, the fifty oscillations last slightly longer. If, on the other hand, the frequency is higher than 50Hz, the fifty oscillations are shorter. Since one second of grid time always constitutes precisely fifty oscillations, the grid seconds therefore last slightly shorter or longer depending on the frequency.

Due to a disruption of the power system originating in Serbia/Kosovo since mid January 2018, a total of 113GWh of the energy production in Europe has been missing. Electrical generators in other European countries had to do more work, as they tried to cover this loss. This however has some side-effects:

The electrical generators of an electricity grid rotate more readily and faster when consumption is low. Consequently, they rotate with a higher frequency. Conversely, the electrical generators rotate more laboriously and with a lower frequency when consumption is greater.

With Europe’s grid running at a frequency slightly slower than 50Hz, Grid Time has started to drift off. This is known as Grid Time Deviation:

The Grid Time Deviation is calculated by comparing Grid Time with UTC time (coordinated universal time), which is determined using highly precise atomic clocks.

Ever since mid January 2018 this Grid Time Deviation has been building up. At the time of writing Grid Time Deviation is about -5 minutes (e.g. clocks are lagging behind by 5 minutes). You can check the Grid Frequency and Grid Time Deviation yourself on Swiss Grid’s frequency page:

Grid Time Drift, dd 2018-03-07

Usually the maintainers of the electricity grid adjust the frequency to keep Grid Time in sync with UTC:

The Grid Time Deviation is constantly balanced out. If the time deviation is more than twenty seconds the frequency is corrected in the grid. In order to balance out the time deviation again the otherwise customary frequency of 50 Hz (Europe) is changed as follows:

  • 49.990 Hz, if the grid time is running ahead of UTC time
  • 50.010 Hz, if the grid time is lagging behind UTC time

This time however they can’t keep up, as 113GWh is a huge amount of energy. Thankfully it didn’t drop below 47.5Hz, because then we’d be having blackouts.

Original Content , Leave a comment

Smarter Every Day: A Real Life Haptic Glove

Destin from Smarter Every Day tests a Real Life Haptic Glove – created by HaptX Inc. – and is really impressed:

The glove is packed with sensors and “things” to give haptic feedback allowing one to pick up virtual things and feel stuff laying on their hand.

Elsewhere , Leave a comment

Carthage – A simple, decentralized dependency manager for Cocoa

Whilst checking out the aforementioned IMcD23/TabView and a few other iOS/macOS libraries I could not help by notice the lack of CocoaPods and the presense of Carthage. Apparently the community is now leaning more towards the latter.

Carthage is intended to be the simplest way to add frameworks to your Cocoa application.

Carthage builds your dependencies and provides you with binary frameworks, but you retain full control over your project structure and setup. Carthage does not automatically modify your project files or your build settings.

Dependencies are defined in a Cartfile:

# Require version 2.3.1 or later
github "ReactiveCocoa/ReactiveCocoa" >= 2.3.1

# Require version 1.x
github "Mantle/Mantle" ~> 1.0    # (1.0 or later, but less than 2.0)

# Require exactly version 0.4.1
github "jspahrsummers/libextobjc" == 0.4.1

# Use the latest version
github "jspahrsummers/xcconfigs"

# Use the branch
github "jspahrsummers/xcconfigs" "branch"

# Use a project from GitHub Enterprise
github "https://enterprise.local/ghe/desktop/git-error-translations"

# Use a project from any arbitrary server, on the "development" branch
git "https://enterprise.local/desktop/git-error-translations2.git" "development"

# Use a local project
git "file:///directory/to/project" "branch"

# A binary only framework
binary "" ~> 2.3

After running carthage the lockfile Cartfile.resolved (which you should commit into your version control system!) will be created. Dev dependencies can be stored in a Cartfile.private file.

So why is Carthage getting more popular? From their README, these two here caught my attention:

CocoaPods (by default) automatically creates and updates an Xcode workspace for your application and all dependencies. Carthage builds framework binaries using xcodebuild, but leaves the responsibility of integrating them up to the user. CocoaPods’ approach is easier to use, while Carthage’s is flexible and unintrusive.

Carthage has been created as a decentralized dependency manager. There is no central list of projects, which reduces maintenance work and avoids any central point of failure.

Installation possible using Homebrew:

brew install carthage

Carthage – A simple, decentralized dependency manager for Cocoa →

Elsewhere , , , Leave a comment

IMcD23/TabView – Easily add multiple tabs to your iOS app, styled similar to Safari for iPad.

There are two primary view controllers in this library: TabViewController and TabViewContainerViewController. A TabViewController contains an array of tabs, a visible tab, and some methods to add and remove tabs. A TabViewContainerViewController contains TabViewControllers.

IMcD23/TabView (GitHub) →

(via Louis D’hauwe)

Elsewhere , , 1 Comment

Run your tests using Jest & Puppeteer with jest-puppeteer

With jest-puppeteer – and its included expect-puppeteer assertion library – it’s possible to use Puppeteer within your Jest tests.

Writing integration test can be done using Puppeteer API but it can be complicated and hard because API is not designed for testing.

To make it simpler, an expectPage() is automatically installed and available, it provides a lot of convenient methods, all documented in expect-puppeteer API.

describe('Google', () => {
  beforeAll(async () => {
    await page.goto('')

  it('should display "google" text on page', async () => {

With expect-puppeteer it’s also easy peasy to click buttons, complete forms, etc.

// Assert that a form will be filled
await expectPage().toFillForm('form[name="myForm"]', {
  firstName: 'James',
  lastName: 'Bond',


Elsewhere , , , , Leave a comment

30 seconds of CSS

I like these bite-sized CSS snippets. Reminds me of BRICSS (rip)

30 seconds of CSS →

Elsewhere , Leave a comment

Waymo 360° Experience: A Fully Self-Driving Journey

Waymo began as the Google self-driving car project in 2009. Today, we have the world’s only fleet of fully self-driving cars on public roads. Step into our 360° video and take control of the camera to see through the “eyes” of our car. Then, be one of the first in the world to take a ride with Waymo.

Elsewhere , , Leave a comment

MySQL ST_Distance_Sphere Polyfill

One of the cool things about MySQL 5.7 is the fact that it sports a few spatial convenience functions (since 5.7.6), allowing one to do operations on geometric values.

One of those convenience functions is ST_Distance_Sphere, which allows one to calculate the (spherical) distance between two points.

Recently I was working an project where I needed said function, yet unfortunately they were running some version of MySQL 5.6 … on which ST_Distance_Sphere isn’t available.

Instead of requesting to upgrade the MySQL server, I decided to polyfill ST_Distance_Sphere instead. It’s really easy since it’s a function, and it basically is nothing more than the Haversine Formula which I, as a mapping aficionado, know how to juggle.



CREATE FUNCTION `ST_Distance_Sphere` (point1 POINT, point2 POINT)

	no sql deterministic
		declare R INTEGER DEFAULT 6371000;
		declare `φ1` float;
		declare `φ2` float;
		declare `Δφ` float;
		declare `Δλ` float;
		declare a float;
		declare c float;
		set `φ1` = radians(y(point1));
		set `φ2` = radians(y(point2));
		set `Δφ` = radians(y(point2) - y(point1));
		set `Δλ` = radians(x(point2) - x(point1));

		set a = sin(`Δφ` / 2) * sin(`Δφ` / 2) + cos(`φ1`) * cos(`φ2`) * sin(`Δλ` / 2) * sin(`Δλ` / 2);
		set c = 2 * atan2(sqrt(a), sqrt(1-a));

		return R * c;


Run the little snippet above on your server after having selected a database first. Once executed it’ll persistently be available (just like a Stored Procedure) for you to use. Usage is the same as if it were natively available:

SELECT ST_Distance_Sphere(
  POINT(-87.6770458, 41.9631174),
  POINT(-73.9898293, 40.7628267)

// ~> 1148978.6738241839 (in metres)

Happy Mapping! 🙂

Did this help you out? Like what you see? Consider donating.

☕️ Buy me a Coffee ($3)

It certainly is no obligation but it would put a smile on my face. Thanks! 🙂

Original Content , , Leave a comment

Responsive Components: a Solution to the Container Queries Problem

Extensive writeup by Philip Walton on how he tackles the Container Queries problem.

Instead of narrowly focusing on the specific CSS feature proposal we call “container queries”, I want to focus on the broader concept of building components that respond to their environment. And if you accept this larger framing, there are actually new web APIs that already let you achieve this.

That’s right, we don’t need to wait for container queries to start building responsive components. We can start building them now!

His result takes about the same approach as Elementary takes, but then using the more modern ResizeObserver.

Must say I’m leaning more towards Elementary though, as:

  • Elementary targets the responsive elements themselves, and not their parent element.
  • Elementary defines the breakpoints in the CSS itself and not the HTML (something Philip points out too).
  • Philip’s solutions relies on ResizeObserver which is only available in Chrome right now.

Responsive Components: a Solution to the Container Queries Problem →

Elsewhere , , , Leave a comment

Delighters.JS – Add CSS animations to delight users as they scroll down

Nice little library by Martin Kool / Q42.

Delighters.js toggles classnames as you scroll. You do the rest!

🤓 Late 2013 I created a likewise thingy (dependent on jQuery) 🙂

The main class toggled is .delighter, with an extra .started or .ended to know if the animation just started or ended.

   /* when the library loads, each [data-delighter] 
      gets the .delighter class */

   .foo.delighter {
      transition: all .3s ease-out;
      transform: translateX(-100%);
      opacity: 0;

   /* the .started class is set when the top
      of [data-delighter] is at 0.75 of the viewport 
      (where 0 is top and 1 is bottom) */

   .foo.delighter.started {
      transform: none;
      opacity: 1;

   /* an extra .ended state is set when the bottom 
      of [data-delighter] is at 0.75 of the viewport
      (where 0 is top and 1 is bottom) */

   .foo.delighter.started.ended {
      border: solid red 10px;

Delighters.js →

Elsewhere , , , Leave a comment