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
1109856663Måns Grebäck2019-04-25Sweden
223418217Pizzadude - Jakob Fischer2019-04-25Denmark
34580925Johan Waldenström2019-04-25Sweden
43460759Carl Krull2019-04-25Denmark
53238781Fontourist - Hans Gerhard Meier2019-04-25Norway
62814451Johan Aakerlund2019-04-25Denmark
72744999Listemageren - Klaus Johansen2019-04-25Denmark
82460013CheapProFonts - Roger S. Nelsson2019-04-25Norway
91882700HENRIavecunK - Henrik2019-04-25Sweden
101280113Flight of the Dragon - Hasan Guven2019-04-25Norway
111102241Christian Munk2019-04-25Denmark
12716253Your Own Font - Ellinor Rapp2019-04-25Sweden
13681896Adam Ericsson2019-04-25Sweden
14677695bogstav2019-04-25Denmark
15556645Vinterstille TypeFaceLab - Klaus Nielsen2019-04-25Denmark
16500189Viktor Hammarberg2019-04-25Sweden
17467224Moonbase Press - Svein Kåre Gunnarson2019-04-25Norway
18408432Espen Morten Kvalheim2019-04-25Norway
19373829Thor Christopher Arisland2019-04-25Norway
20354284Staffan Vilcans2019-04-25Sweden
21335931Martin Holm2019-04-25Norway
22317968Jonas Borneland Hansen2019-04-25Denmark
23235985Norwegian Ink / Design for Dough - Frode Nordbø2019-04-25Norway
24208707David Engelby2019-04-25Denmark
25207106Anton - Anton Lundström2019-04-25Sweden
26199529dawnland - Daniel Viberg2019-04-25Sweden
27178908211178 Creative Agency - Morten Talleivsen2019-04-25Norway
28139376Martin Sørensen2019-04-25Denmark
29107085Andreas Larsen2019-04-25Denmark
30103356Nils Kähler2019-04-25Denmark
3197602Bolahool Graphics2019-04-25Sweden
3294380McKack2019-04-25Norway
3390310Joaquim Marquès Nielsen2019-04-25Denmark
3486638Anton Bohlin2019-04-25Sweden
3582835Pär Lundkvist2019-04-25Sweden
3675865Digital Flame Studios - sindre små2019-04-25Norway
3773216Intense2019-04-25Norway
3864209huskmelk - Rashid Akrim2019-04-25Norway
3960722Kyrre Honohan2019-04-25Norway
4055334Pia Hed Aspell2019-04-25Sweden
4153956Nadia Rosenfeldt2019-04-25Denmark
4252001Linn Mustanoja2019-04-25Sweden
4350308Lars Håhus2019-04-25Sweden
4444659ronjam - Ronja Melcker2019-04-25Sweden
4542074Atle Mo2019-04-25Norway
4636617Erik Jeddere-Fisher2019-04-25Norway
4733454charmingfan2019-04-25Denmark
4833437benjamin rauber2019-04-25Sweden
4933262Arman Ay2019-04-25Sweden
5027259Mark Lund2019-04-25Norway
5126693Botond Bokor2019-04-25Sweden
5226430Dan Thorup2019-04-25Denmark
5326099Andrew Nordquist2019-04-25Sweden
5425883Lisa2019-04-25Norway
5525756Carl Enlund2019-04-25Sweden
5625443Studio Indigo - Helena Öhman2019-04-25Sweden
5724859Aske Ching2019-04-25Denmark
5821821Andreas2019-04-25Sweden
5921247Erik Holm2019-04-25Norway
6020889Henrik Johansson2019-04-25Sweden
6120826Bull - Sandra Madsen2019-04-25Denmark
6220599David Lindecrantz2019-04-25Sweden
6319952Kristian Dalen2019-04-25Norway
6417262Mandy Pandy2019-04-25Sweden
6515038Christian Koch2019-04-25Denmark
6613500Alexander Rossebø2019-04-25Norway
6712718Johan Brodd2019-04-25Sweden
6811563Viktor Örneland2019-04-25Sweden
699869Mathias Alvebring2019-04-25Sweden
709627Boksen2019-04-25Norway
718650Benjamin Blåholtz2019-04-25Sweden
727833vardcentralen2019-04-25Sweden
737661Mathias Rue2019-04-25Denmark
747147Manuela Hardy2019-04-25Norway
756965Gröt Havregrynsson2019-04-25Sweden
766827Caesar2019-04-25Sweden
776784Sara Lindberg2019-04-25Sweden
786426Mattis Folkestad2019-04-25Norway
795901Oliver Waldemar2019-04-25Sweden
805127Simon Jakobsson2019-04-25Sweden
814363KingDGaming - Elias Eriksson2019-04-25Sweden

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.