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
1106926769Måns Grebäck2018-11-18Sweden
222816293Pizzadude - Jakob Fischer2018-11-18Denmark
34520421Johan Waldenström2018-11-18Sweden
43399398Mr.fisk Fonts - Mike Larsson2018-11-18Sweden
53315539Carl Krull2018-11-18Denmark
63224287Fontourist - Hans Gerhard Meier2018-11-18Norway
72714782Listemageren - Klaus Johansen2018-11-18Denmark
82641361Johan Aakerlund2018-11-18Denmark
92410889CheapProFonts - Roger S. Nelsson2018-11-18Norway
101681481HENRIavecunK - Henrik2018-11-18Sweden
111262275Flight of the Dragon - Hasan Guven2018-11-18Norway
121068222Christian Munk2018-11-18Denmark
13713277Your Own Font - Ellinor Rapp2018-11-18Sweden
14610696bogstav2018-11-18Denmark
15603482Adam Ericsson2018-11-18Sweden
16552142Vinterstille TypeFaceLab - Klaus Nielsen2018-11-18Denmark
17487379Viktor Hammarberg2018-11-18Sweden
18445923Moonbase Press - Svein Kåre Gunnarson2018-11-18Norway
19406513Espen Morten Kvalheim2018-11-18Norway
20351202Staffan Vilcans2018-11-18Sweden
21340240Thor Christopher Arisland2018-11-18Norway
22325910Martin Holm2018-11-18Norway
23315116Jonas Borneland Hansen2018-11-18Denmark
24234055Norwegian Ink / Design for Dough - Frode Nordbø2018-11-18Norway
25206002David Engelby2018-11-18Denmark
26205708Anton - Anton Lundström2018-11-18Sweden
27198318dawnland - Daniel Viberg2018-11-18Sweden
28176381211178 Creative Agency - Morten Talleivsen2018-11-18Norway
29134976Martin Sørensen2018-11-18Denmark
3097113Andreas Larsen2018-11-18Denmark
3195575Bolahool Graphics2018-11-18Sweden
3294603Nils Kähler2018-11-18Denmark
3393943McKack2018-11-18Norway
3489821Joaquim Marquès Nielsen2018-11-18Denmark
3583363Anton Bohlin2018-11-18Sweden
3682602Pär Lundkvist2018-11-18Sweden
3775615Digital Flame Studios - sindre små2018-11-18Norway
3872865Intense2018-11-18Norway
3963195huskmelk - Rashid Akrim2018-11-18Norway
4060505Kyrre Honohan2018-11-18Norway
4155015Pia Hed Aspell2018-11-18Sweden
4253352Nadia Rosenfeldt2018-11-18Denmark
4351519Linn Mustanoja2018-11-18Sweden
4449372Lars Håhus2018-11-18Sweden
4544034ronjam - Ronja Melcker2018-11-18Sweden
4641303Atle Mo2018-11-18Norway
4736178Erik Jeddere-Fisher2018-11-18Norway
4833319charmingfan2018-11-18Denmark
4932635benjamin rauber2018-11-18Sweden
5031986Arman Ay2018-11-18Sweden
5127026Mark Lund2018-11-18Norway
5226190Botond Bokor2018-11-18Sweden
5325979Dan Thorup2018-11-18Denmark
5425919Andrew Nordquist2018-11-18Sweden
5525813Lisa2018-11-18Norway
5624588Aske Ching2018-11-18Denmark
5723063Carl Enlund2018-11-18Sweden
5821683Andreas2018-11-18Sweden
5920835Studio Indigo - Helena Öhman2018-11-18Sweden
6020681Bull - Sandra Madsen2018-11-18Denmark
6120527Erik Holm2018-11-18Norway
6220472Henrik Johansson2018-11-18Sweden
6320346David Lindecrantz2018-11-18Sweden
6419856Kristian Dalen2018-11-18Norway
6517107Mandy Pandy2018-11-18Sweden
6614714Christian Koch2018-11-18Denmark
6713156Alexander Rossebø2018-11-18Norway
6812613Johan Brodd2018-11-18Sweden
6911311Viktor Örneland2018-11-18Sweden
709665Mathias Alvebring2018-11-18Sweden
719469Boksen2018-11-18Norway
727737vardcentralen2018-11-18Sweden
737582Mathias Rue2018-11-18Denmark
746972Manuela Hardy2018-11-18Norway
756686Gröt Havregrynsson2018-11-18Sweden
766673Caesar2018-11-18Sweden
776623Sara Lindberg2018-11-18Sweden
786334Mattis Folkestad2018-11-18Norway
795629Oliver Waldemar2018-11-18Sweden
805008Simon Jakobsson2018-11-18Sweden
814284KingDGaming - Elias Eriksson2018-11-18Sweden

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.