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
1109288666Måns Grebäck2019-03-19Sweden
223292223Pizzadude - Jakob Fischer2019-03-19Denmark
34565689Johan Waldenström2019-03-19Sweden
43424469Carl Krull2019-03-19Denmark
53235359Fontourist - Hans Gerhard Meier2019-03-19Norway
62767963Johan Aakerlund2019-03-19Denmark
72738035Listemageren - Klaus Johansen2019-03-19Denmark
82448463CheapProFonts - Roger S. Nelsson2019-03-19Norway
91832808HENRIavecunK - Henrik2019-03-19Sweden
101275785Flight of the Dragon - Hasan Guven2019-03-19Norway
111095155Christian Munk2019-03-19Denmark
12715592Your Own Font - Ellinor Rapp2019-03-19Sweden
13663884bogstav2019-03-19Denmark
14661551Adam Ericsson2019-03-19Sweden
15555547Vinterstille TypeFaceLab - Klaus Nielsen2019-03-19Denmark
16497030Viktor Hammarberg2019-03-19Sweden
17462026Moonbase Press - Svein Kåre Gunnarson2019-03-19Norway
18407996Espen Morten Kvalheim2019-03-19Norway
19366445Thor Christopher Arisland2019-03-19Norway
20353594Staffan Vilcans2019-03-19Sweden
21333122Martin Holm2019-03-19Norway
22317221Jonas Borneland Hansen2019-03-19Denmark
23235562Norwegian Ink / Design for Dough - Frode Nordbø2019-03-19Norway
24208014David Engelby2019-03-19Denmark
25206786Anton - Anton Lundström2019-03-19Sweden
26199249dawnland - Daniel Viberg2019-03-19Sweden
27178311211178 Creative Agency - Morten Talleivsen2019-03-19Norway
28138381Martin Sørensen2019-03-19Denmark
29104166Andreas Larsen2019-03-19Denmark
30100782Nils Kähler2019-03-19Denmark
3197136Bolahool Graphics2019-03-19Sweden
3294264McKack2019-03-19Norway
3390206Joaquim Marquès Nielsen2019-03-19Denmark
3485712Anton Bohlin2019-03-19Sweden
3582779Pär Lundkvist2019-03-19Sweden
3675791Digital Flame Studios - sindre små2019-03-19Norway
3773139Intense2019-03-19Norway
3863946huskmelk - Rashid Akrim2019-03-19Norway
3960669Kyrre Honohan2019-03-19Norway
4055276Pia Hed Aspell2019-03-19Sweden
4153821Nadia Rosenfeldt2019-03-19Denmark
4251912Linn Mustanoja2019-03-19Sweden
4350072Lars Håhus2019-03-19Sweden
4444535ronjam - Ronja Melcker2019-03-19Sweden
4541893Atle Mo2019-03-19Norway
4636500Erik Jeddere-Fisher2019-03-19Norway
4733422charmingfan2019-03-19Denmark
4833261benjamin rauber2019-03-19Sweden
4932992Arman Ay2019-03-19Sweden
5027214Mark Lund2019-03-19Norway
5126587Botond Bokor2019-03-19Sweden
5226314Dan Thorup2019-03-19Denmark
5326071Andrew Nordquist2019-03-19Sweden
5425871Lisa2019-03-19Norway
5525248Carl Enlund2019-03-19Sweden
5624810Aske Ching2019-03-19Denmark
5724237Studio Indigo - Helena Öhman2019-03-19Sweden
5821793Andreas2019-03-19Sweden
5921091Erik Holm2019-03-19Norway
6020786Bull - Sandra Madsen2019-03-19Denmark
6120781Henrik Johansson2019-03-19Sweden
6220551David Lindecrantz2019-03-19Sweden
6319932Kristian Dalen2019-03-19Norway
6417229Mandy Pandy2019-03-19Sweden
6514957Christian Koch2019-03-19Denmark
6613418Alexander Rossebø2019-03-19Norway
6712702Johan Brodd2019-03-19Sweden
6811503Viktor Örneland2019-03-19Sweden
699822Mathias Alvebring2019-03-19Sweden
709599Boksen2019-03-19Norway
717814vardcentralen2019-03-19Sweden
727737Benjamin Blåholtz2019-03-19Sweden
737645Mathias Rue2019-03-19Denmark
747102Manuela Hardy2019-03-19Norway
756905Gröt Havregrynsson2019-03-19Sweden
766788Caesar2019-03-19Sweden
776749Sara Lindberg2019-03-19Sweden
786401Mattis Folkestad2019-03-19Norway
795831Oliver Waldemar2019-03-19Sweden
805108Simon Jakobsson2019-03-19Sweden
814346KingDGaming - Elias Eriksson2019-03-19Sweden

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:

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

What week is this?

Today I was a bit impulsive and registered the domain name weeknum.org.

Then I made a little php-application showing the day of the week, with the background color calculated using the week number, month and day to create a hex code.

I might even try out some AJAX and jQuery on this page and see if I can make it a little more stylish and interactive.

If you want to check start and end dates of another week number, just add the suffix /[week number] to the URL.

For example, if you want to find information about week number 42, then go to weeknum.org/42.