Fontstats Plugin

Today I finished a little WordPress plugin I’ve been working on.

It’s a two part plugin, one php script collects data from any Norwegian designer on DaFont by visiting each site, and by the power of Regex-Grayskull it inserts it into a database on my website.

The WordPress plugin then selects the last sampled date and displays it in a HTML-table on any post or page where I insert the registered shortcode.

Here’s the result:

No.DownloadsDesignerDate SampledCountry
1110683031Måns Grebäck2019-06-17Sweden
223599396Pizzadude - Jakob Fischer2019-06-17Denmark
34601397Johan Waldenström2019-06-17Sweden
43507463Carl Krull2019-06-17Denmark
53243128Fontourist - Hans Gerhard Meier2019-06-17Norway
62875205Johan Aakerlund2019-06-17Denmark
72755094Listemageren - Klaus Johansen2019-06-17Denmark
82475080CheapProFonts - Roger S. Nelsson2019-06-17Norway
91930396HENRIavecunK - Henrik2019-06-17Sweden
101285954Flight of the Dragon - Hasan Guven2019-06-17Norway
111111794Christian Munk2019-06-17Denmark
12717253Your Own Font - Ellinor Rapp2019-06-17Sweden
13707328Adam Ericsson2019-06-17Sweden
14697680bogstav2019-06-17Denmark
15558157Vinterstille TypeFaceLab - Klaus Nielsen2019-06-17Denmark
16503536Viktor Hammarberg2019-06-17Sweden
17473666Moonbase Press - Svein Kåre Gunnarson2019-06-17Norway
18409056Espen Morten Kvalheim2019-06-17Norway
19382832Thor Christopher Arisland2019-06-17Norway
20355235Staffan Vilcans2019-06-17Sweden
21339451Martin Holm2019-06-17Norway
22318795Jonas Borneland Hansen2019-06-17Denmark
23236558Norwegian Ink / Design for Dough - Frode Nordbø2019-06-17Norway
24209533David Engelby2019-06-17Denmark
25207567Anton - Anton Lundström2019-06-17Sweden
26199963dawnland - Daniel Viberg2019-06-17Sweden
27179674211178 Creative Agency - Morten Talleivsen2019-06-17Norway
28140724Martin Sørensen2019-06-17Denmark
29111010Andreas Larsen2019-06-17Denmark
30106736Nils Kähler2019-06-17Denmark
3198271Bolahool Graphics2019-06-17Sweden
3294527McKack2019-06-17Norway
3390454Joaquim Marquès Nielsen2019-06-17Denmark
3487797Anton Bohlin2019-06-17Sweden
3582905Pär Lundkvist2019-06-17Sweden
3675959Digital Flame Studios - sindre små2019-06-17Norway
3773341Intense2019-06-17Norway
3864636huskmelk - Rashid Akrim2019-06-17Norway
3960791Kyrre Honohan2019-06-17Norway
4055446Pia Hed Aspell2019-06-17Sweden
4154152Nadia Rosenfeldt2019-06-17Denmark
4252129Linn Mustanoja2019-06-17Sweden
4350563Lars Håhus2019-06-17Sweden
4444867ronjam - Ronja Melcker2019-06-17Sweden
4542330Atle Mo2019-06-17Norway
4636740Erik Jeddere-Fisher2019-06-17Norway
4733681benjamin rauber2019-06-17Sweden
4833669Arman Ay2019-06-17Sweden
4933489charmingfan2019-06-17Denmark
5027410Studio Indigo - Helena Öhman2019-06-17Sweden
5127327Mark Lund2019-06-17Norway
5226863Botond Bokor2019-06-17Sweden
5326596Dan Thorup2019-06-17Denmark
5426556Carl Enlund2019-06-17Sweden
5526165Andrew Nordquist2019-06-17Sweden
5625908Lisa2019-06-17Norway
5724941Aske Ching2019-06-17Denmark
5821868Andreas2019-06-17Sweden
5921453Erik Holm2019-06-17Norway
6021002Benjamin Blåholtz2019-06-17Sweden
6120996Henrik Johansson2019-06-17Sweden
6220877Bull - Sandra Madsen2019-06-17Denmark
6320672David Lindecrantz2019-06-17Sweden
6419997Kristian Dalen2019-06-17Norway
6517301Mandy Pandy2019-06-17Sweden
6615134Christian Koch2019-06-17Denmark
6713601Alexander Rossebø2019-06-17Norway
6812750Johan Brodd2019-06-17Sweden
6911651Viktor Örneland2019-06-17Sweden
709928Mathias Alvebring2019-06-17Sweden
719674Boksen2019-06-17Norway
727869vardcentralen2019-06-17Sweden
737684Mathias Rue2019-06-17Denmark
747200Manuela Hardy2019-06-17Norway
757066Gröt Havregrynsson2019-06-17Sweden
766878Caesar2019-06-17Sweden
776830Sara Lindberg2019-06-17Sweden
786455Mattis Folkestad2019-06-17Norway
796023Oliver Waldemar2019-06-17Sweden
805159Simon Jakobsson2019-06-17Sweden
814395KingDGaming - Elias Eriksson2019-06-17Sweden

Regex 101

Today I received an email from the store I used to work at asking me to make a printer friendly version of an online table of information.

As I learned more about regular expressions from the “INF3331” course I took this fall, solving this problem proved to be way easier than any previous attempts at the likes of it.

At times I’ve thought that regexes are harder to read and debug than ordinary programming languages, but with a good editor like Atom or the regex101 page, it all became a lot less stressful.

As far as editors go, I have to admit that I still use emacs when I’m not using an IDE or GUI-editor.

Note to self about regular expressions.

(.*?) to capture zero or more characters in a non-greedy manner

(?:.*?) for the same grouping without backreferences.

$1 or $[group-number] for backreferences in JavaScript and Atom

\1 or \[group-number] for backreferences in Python, PHP.

Perl and PHP also uses \g1 or \g[group-number] for backreferences.

The following characters need to be escaped in regex:

.^$*+?()[{\|

Web Drafter

A tiny online vector graphics application.

Click here to try it out.

As a small project to familiarise myself with JavaScript, jQuery and SVG I started working on a small vector graphics app using the SVG.js library.

At first I was thinking of manipulating SVG-text directly as I had done with my desktop Java applications, but since I found that simply appending or updating the inner html of divs didn’t refresh the SVG canvas and other annoying things I found it was smarter to just use a simple JavaScript library for this.

In addition to learning a lot of jQuery and JavaScript, especially understanding the specifics of JavaScripts idiosyncratic approach to OOP, I learned a bit about which existing libraries there are and how to use them. For this small application, SVG.js did nicely, but I also learned about a larger library called Raphaƫl, and an interesting little script called Flowtype, that automagically resizes the font size in relation to the window size.

I put the source code of my little application on GitHub here.

Up to now I’ve only managed to do the most basic rectilinear polygons, with the foundations set for snapping and I’m planning to create a simple colour-picker functionality for the stroke, fill and opacity.

The hotkeys are:

cmd+z – UNDO (mac)

ctrl+z – UNDO (windows, linux)

D – Delete the last polygon.

S – Show data on the selected polygon.

Polygons are created by closing the path.

This is done by creating a line where the end coordinate is the same as the first coordinate of the polygon.