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.

C

I noticed that my programming page was sadly empty.

So to have some actual content I started writing a bit about C so I can rehash and remind myself of what I’ve learned about the C programming language.

It’s some really basic stuff, and of course, I’ve made programs to do a lot more than just print to terminal and work on simple variables, but I have to start somewhere when I write about that stuff.

Let's start at the very beginning. 

A very good place to start.

When you read you begin with ABC.

When you code you compile with G C C

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 Sampled
13180091Fontourist - Hans Gerhard Meier2018-01-11
22307029CheapProFonts - Roger S. Nelsson2018-01-11
31227379Flight of the Dragon - Hasan Guven2018-01-11
4407689Moonbase Press - Svein Kåre Gunnarson2018-01-11
5402166Espen Morten Kvalheim2018-01-11
6306375Martin Holm2018-01-11
7230160Norwegian Ink / Design for Dough - Frode Nordbø2018-01-11
8203762Thor Christopher Arisland2018-01-11
9168370211178 Creative Agency - Morten Talleivsen2018-01-11
1092931McKack2018-01-11
1175146Digital Flame Studios - sindre små2018-01-11
1271980Intense2018-01-11
1360710huskmelk - Rashid Akrim2018-01-11
1460042Kyrre Honohan2018-01-11
1539464Atle Mo2018-01-11
1635259Erik Jeddere-Fisher2018-01-11
1726578Mark Lund2018-01-11
1825639Lisa2018-01-11
1919580Kristian Dalen2018-01-11
2018765Erik Holm2018-01-11
2112433Alexander Rossebø2018-01-11
229182Boksen2018-01-11
236624Manuela Hardy2018-01-11
246149Mattis Folkestad2018-01-11

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.

Even more modular

Yet another font is in the works, right now it feels a bit like I’m working in a “pipeline” fashion making multiple fonts concurrently. My script font is basically finished (with some spacing and kerning issues to be addressed if it isn’t accepted on DaFont) and a link will be posted when it’s available on all the sites.

Kerning

I’ve been working on a script font for some time now, I finally got around to making the majuscules, numbers and punctuation, but I have to redo the kerning table.

THIS is why I prefer designing monospace fonts.

At least I’m gaining some experience in kerning and spacing.