Interactive jQuery Menu

A few days ago I was asked to update the layout of the website for a store I used to work at.

I thought this was a good chance to get to know jQuery animations, so I put together a bunch of stock images as background, edited pictures of frames and put some text in the frames for the icons.

I worked with artboards in Affinity Designer so I could export multiple images to different files, I also worked with groups and a transparent background so I could make .png files of the frames and put them on top of the background images.

That way I used the background-image css property, with display set to block and could superimpose a png with transparency over another image.

With jQuery I selected all images, where each image has a class “RT” and I used the reserved word this to select the particular instance for mouseover and mouseleave events.

With this I managed to make a fun little menu where the frame with the text grows and shrinks according to mouse-events.

The result can be seen here.

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
1108236568Måns Grebäck2019-01-20Sweden
223013930Pizzadude - Jakob Fischer2019-01-20Denmark
34542578Johan Waldenström2019-01-20Sweden
43408006Mr.fisk Fonts - Mike Larsson2019-01-20Sweden
53368716Carl Krull2019-01-20Denmark
63230024Fontourist - Hans Gerhard Meier2019-01-20Norway
72726368Listemageren - Klaus Johansen2019-01-20Denmark
82703000Johan Aakerlund2019-01-20Denmark
92430132CheapProFonts - Roger S. Nelsson2019-01-20Norway
101736624HENRIavecunK - Henrik2019-01-20Sweden
111268871Flight of the Dragon - Hasan Guven2019-01-20Norway
121081700Christian Munk2019-01-20Denmark
13714428Your Own Font - Ellinor Rapp2019-01-20Sweden
14638704bogstav2019-01-20Denmark
15630282Adam Ericsson2019-01-20Sweden
16553796Vinterstille TypeFaceLab - Klaus Nielsen2019-01-20Denmark
17492306Viktor Hammarberg2019-01-20Sweden
18453970Moonbase Press - Svein Kåre Gunnarson2019-01-20Norway
19407199Espen Morten Kvalheim2019-01-20Norway
20352329Staffan Vilcans2019-01-20Sweden
21349614Thor Christopher Arisland2019-01-20Norway
22328732Martin Holm2019-01-20Norway
23316128Jonas Borneland Hansen2019-01-20Denmark
24234779Norwegian Ink / Design for Dough - Frode Nordbø2019-01-20Norway
25206959David Engelby2019-01-20Denmark
26206294Anton - Anton Lundström2019-01-20Sweden
27198773dawnland - Daniel Viberg2019-01-20Sweden
28177320211178 Creative Agency - Morten Talleivsen2019-01-20Norway
29136546Martin Sørensen2019-01-20Denmark
30100313Andreas Larsen2019-01-20Denmark
3197393Nils Kähler2019-01-20Denmark
3296367Bolahool Graphics2019-01-20Sweden
3394098McKack2019-01-20Norway
3490023Joaquim Marquès Nielsen2019-01-20Denmark
3584532Anton Bohlin2019-01-20Sweden
3682680Pär Lundkvist2019-01-20Sweden
3775701Digital Flame Studios - sindre små2019-01-20Norway
3872974Intense2019-01-20Norway
3963518huskmelk - Rashid Akrim2019-01-20Norway
4060582Kyrre Honohan2019-01-20Norway
4155136Pia Hed Aspell2019-01-20Sweden
4253559Nadia Rosenfeldt2019-01-20Denmark
4351709Linn Mustanoja2019-01-20Sweden
4449693Lars Håhus2019-01-20Sweden
4544271ronjam - Ronja Melcker2019-01-20Sweden
4641595Atle Mo2019-01-20Norway
4736334Erik Jeddere-Fisher2019-01-20Norway
4833363charmingfan2019-01-20Denmark
4932929benjamin rauber2019-01-20Sweden
5032494Arman Ay2019-01-20Sweden
5127116Mark Lund2019-01-20Norway
5226392Botond Bokor2019-01-20Sweden
5326121Dan Thorup2019-01-20Denmark
5425987Andrew Nordquist2019-01-20Sweden
5525843Lisa2019-01-20Norway
5624717Aske Ching2019-01-20Denmark
5724487Carl Enlund2019-01-20Sweden
5822674Studio Indigo - Helena Öhman2019-01-20Sweden
5921733Andreas2019-01-20Sweden
6020787Erik Holm2019-01-20Norway
6120735Bull - Sandra Madsen2019-01-20Denmark
6220620Henrik Johansson2019-01-20Sweden
6320447David Lindecrantz2019-01-20Sweden
6419891Kristian Dalen2019-01-20Norway
6517164Mandy Pandy2019-01-20Sweden
6614838Christian Koch2019-01-20Denmark
6713284Alexander Rossebø2019-01-20Norway
6812653Johan Brodd2019-01-20Sweden
6911383Viktor Örneland2019-01-20Sweden
709742Mathias Alvebring2019-01-20Sweden
719529Boksen2019-01-20Norway
727777vardcentralen2019-01-20Sweden
737607Mathias Rue2019-01-20Denmark
747035Manuela Hardy2019-01-20Norway
756796Gröt Havregrynsson2019-01-20Sweden
766719Caesar2019-01-20Sweden
776677Sara Lindberg2019-01-20Sweden
786371Mattis Folkestad2019-01-20Norway
795736Oliver Waldemar2019-01-20Sweden
805061Simon Jakobsson2019-01-20Sweden
814308KingDGaming - Elias Eriksson2019-01-20Sweden

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.