A Five Minute Hack

19th December 2018

Click the link or type runes.rocks into your web browser and you will be directed to a random article about a rune inscription or runestone.

I love small ideas and experiments. They are cheap they scale from a few hours to a few moths. An example I’m often refer to is Kyrksok.se a site we build a few years ago in less then two days.

However runes.rocks and the Swedish version runor.rocks sets a new record. It took me five minutes to buy the domain names and everything up thanks to existing tools.

I bought domain names and pointed the redirect URL to Magnus Manske’s Random article tool and waited for the name servers to update. Done.

Landerydsstenen CC-BY Bengt A Lundberg / Riksantikvarieämbetet Image of a rune stone

I Created Another On this Day API

26th September 2018

screenshot of documentation

There are multiple “On this Day” APIs built on top of Wikipedia but I created yet another one. This API can be used to retrieve birth, deaths, and events for any given day of the year.

The reason for building this was that I wanted something stable with support for things like Cross-Origin-Requests and SSL. The need wasn’t actually mine. A friend of mine sees the potential of “On this Day” information as a possible delighter in everyday contexts and I offered to help.

The data is (because it’s harvested from Wikipedia) licensed under Creative Commons Attribution-ShareAlike 3.0 Unported The API is actually just a collection of pre-generated static JSON files cached and exposed using Cloudflare. So feel free to query without limits.

API Sandbox and Documentation

Rounding Colors with Colorsnap

9th September 2018

While working on an evaluation of Generous Interfaces in the GLAM sector at the Swedish National Heritage Board we extracted colors in images to make them searchable by their palettes. For usability reasons we wanted to limit the extracted colors to a comprehensible palette.

Screenshot of our generous interface.

Colorsnap is a Python package for snapping/rounding colors to other colors/palettes. Although I could find plenty of resources and examples on how to do this, I could not find a accessible package.

So now you can do:

pip install colorsnap

Let’s take the hex color #0000ba and round it to its nearest color available as a named color in the CSS 3 specification.

from colorsnap.palettes import CSS_3
from colorsnap import snap_color

snap_color(CSS_3, '#0000ba')
# returns the following tuple ('#0000ba', 'mediumblue')

visualized (input to the left):

Colors compared.

Colorsnap comes with palettes for CSS 2, 2.1, 3, and 4 but you can also use your own:

from colorsnap import snap_color

palette = {
    'black': '#000000',
    'gray': '#808080',
    'white': '#ffffff',
}

snap_color(palette, '#0000ba')

In addition to using named colors you can also round colors to basic hex values:

from colorsnap import snap_color

palette = ['#4286f4', '#414449']

snap_color(palette, '#0000ba')

It’s available over at PyPI and Github.

A Web App for Browsing Sign Languages on Wikidata

14th August 2018

I recently built a web app for browsing and learning sign languages. The original goal was to build an interface on top of SparQL and showcase sign languages content on Wikimedia Commons. This weekend I finally took the time to deploy it. You can try it out here.

Screenshot of the application.

Older