Mark Grealish

the life and code of a crazy cat man


Holy shit, two thousand posts!

This post will be the two thousandth on my blog, give or take. I want it to serve as a bridge between the eleven years of ups and downs in my life, and the bright and unknown future that lies ahead. Eadaoin pointed out to me that I’ve thrown up other retrospectives in the past, […]

Eadaoin in a Christmas Cave

Taken at De Witte Pelikaan in Brugge, Flanders.

Brugge, Flanders

Brugge is one of the top tourist spots in Belgium, and indeed, most of Western Europe. A PDF I pulled up asserts “…29 million overnight stays and 11 million tourist arrivals” to Flanders. Tens of millions of people visited to Brugge over the last half century. Those visitors took somewhere between hundreds and thousands of […]

Brugge from the Dijver

The Dijver is a traditional canal, street and marketplace in the heart of Brugge, although today’s markets sell tourist tat. :) I took this panorama while on a boat trip with Eadaoin.

Platform #12, Brussel-Zuid Train Station

Foggy and dark and cold-the perfect platform for a trip to sunny Brugge!

Eadaoin at Maria and Adrian’s wedding

Taken at Spanish Point Co. Clare on September 1 2016.

Rue des Poissonniers, Brussels

I had Jamaican Blue Mountain coffee right after I took this, which is all kinds of awesome.

Pretty green postbox, Anderlecht, Brussels

There are many such beautiful details to be found if your eyes are adventurous and discerning. :)

Galeries Royales Saint-Hubert, Brussels

Like with everywhere else famous, there’s a weird discontinuity between a Google Maps lookup or a Wikipedia article, and the reality of walking through the arch. It stops being some far off exotic location, and becomes a collection of expensive chocolate and bag shops, and a cafe where I had a great coffee.

La Maison d’Érasme, Anderlecht, Brussels

Erasmus House is gorgeous.

La Maison d’Érasme, Anderlecht, Brussels

Erasmus lived and taught at the house by all accounts. The garden is beautiful, a serene green space in built-up Anderlecht.

The Irish Sea from Blackrock

I wanked around with some sliders in Photoshop because I liked the net effect.


Hackoberfest has made Tic-tac-toe a thing in my life. tictactoe-server opened an issue for a ES6 refactor of the solution checker. I kicked around the lengthy imperative code check and found I wanted to expand the solution, that I wanted to drop in Tic-tac-toe boards of arbitrary size, and to check them in an efficient […]

Moody me

Taken by Eadaoin in Brussels, Belgium.

We’re on a plane!

To Brussels!


Reddit jokes aside, holy shit: I wooed Eadaoin with space facts. We would spent hours on Skype at night when we first went out, where I’d talk about the universe to help get her to sleep.

Decadent kitty comfort

You can’t fake this level of luxury.

Get the prime factors of a given number

This solution uses the Sieve of Eratosthenes and the range() functions I detailed a while back. Hurray for function composition! function factors(number) { const primes = sieve(range(2, number >> 1)).filter(n => !(number % n)); return primes.length ? primes : [number]; } The code is simple: Generate a list of primes in range 2-(n / 2) […]

Rogue One cinematography

It doesn’t matter to me if the rest of Rogue One is awful, not when this is how Gareth Edwards’s presents the Star Wars universe. See, I’m a written science fiction fan. While I don’t keep count of what books I’ve read, I put the count somewhere in the mid hundreds. Some novels I’ve read […]

October at the Digital Hub

Git branch name

It’s a greatly stupid-simple alias: git config alias.branchname '!git branch | grep -E "^\*" | tr -d "* "' git config alias.dammit '!git push -u origin $(git branchname)' git dammit

Recursive Sieve of Eratosthenes

Call me stupid, but the Sieve defeated me for years-I could never quite seem to make it click. TL;DR: Return the first element of the array, joined with the rest of the array with all multiples of the first element removed. A non-zero value is truthy in JavaScript, which is coerced into true, so non-multiples […]

Even occurring element in an array

This solution employs the previous solution. With the XOR method explained, you invert the array: Find the unique elements in the array. Concat the new array to the original. This makes the even (even count) numbers odd, and the odd numbers even. Use the XOR method as before. Behold: function evenOccurring(array) { return [].concat(array, array.filter(unique)).reduce(xor); […]

Odd occurring element in an array

I dug into the problem and discovered that any number XOR’d with itself an odd number of times equals zero, whilst an even number of times equals the number itself: 7 ^ 7 = 0 7 ^ 7 ^ 7 = 7 The trick here is: Numbers which appear in the array an even number […]

Right-cyclic array rotation

The solution is ugly, but fuck it: the code works. Also, code Zen. ;) TL;DR: Create a new array by plucking the last element from the array and making it the first. def rotate(array, count) return array unless (count >= 1 && array.present?) rotate(cycle(array), count - 1) end def cycle(array) [array[-1]] + array[0..-2] end And […]

La chat noir

Twilight at Sandymount Beach

We missed the best of the golden hour, but I for one am satisfied with the twilight we caught.

The best kind of Saturday morning

Eadaoin and Cookie both cuddled up while I study.

Coding Zen in all the strange places

I continue to return to Zen as a way to reach peace with myself. Zen encourages introspection and meditation alongside expressive acts such as calligraphy. The core of Zen calligraphy, such that I understand it, is to cultivate the beginner’s mind. The expert mind is packed with presumption; while an expert mind has a powerful […]


Simple recursive array each method. function each(array, callback) { if (array.length) { callback(array[0]); each(array.slice(1), callback); } }