Mark Grealish

Cats and wizardry.


2016

October


factorial()

Recursive factorial in one line. function factorial(number) { return number < 2 ? 1 : number * factorial(number - 1); }

each()

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

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 […]

The best kind of Saturday morning

Eadaoin and Cookie both cuddled up while I study.

Twilight at Sandymount Beach

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

La chat noir

Rechttp://www.bhalash.com/archives/13544807321onciliation?

Tonight went well.

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 […]

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 […]

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); […]

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 […]

Git branch name

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

October at the Digital Hub

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 […]

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) […]

Decadent kitty comfort

You can’t fake this level of luxury.

me_irl

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. https://xkcd.com/1746/

We’re on a plane!

To Brussels!

Moody me

Taken by Eadaoin in Brussels, Belgium.

Tic-Tac-Toe

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 […]

The Irish Sea from Blackrock

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

Eadaoin and I at 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.

La Maison d’Érasme, Anderlecht, Brussels

Erasmus House is gorgeous.

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.

Pretty green postbox, Anderlecht, Brussels

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

Rue des Poissonniers, Brussels

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

Eadaoin at Maria and Adrian’s wedding

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

Platform #12, Brussel-Zuid Train Station

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

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.

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 […]

Eadaoin in a Christmas Cave

Taken at De Witte Pelikaan in Brugge, Flanders.

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 behind me, and the bright and unknown future ahead. Eadaoin pointed out to me that, yes, I threw up other retrospectives in the […]

Rainy Ranelagh

Autumn has arrived in full force. :(

I mean it this time

That’ll be the title of my autobiography: I Mean It This Time: A lifetime of apologies from my strange self. The diagnosis turned me into some kind of quantum special snowflake. ASD flags me as a Tumblr-grade special snowflake, but at the same the stress of my stress is boring and ordinary. I wrote the […]

Eadaoin at Zonnekemeers, Brugge

Zonnekemeers leads the way out of the old city and into the newer suburbs. You can see the progression in architecture from the 1700s to the 2000s as you walk from one end of the street to the other.

Rue de Formanoir, Anderlecht

About the only thing remarkable about Rue de Formanoir is Erasmus House at the far end from the metro station. There’s a weekend tradition where all the residents come out and turn out their homes to sell knick-knacks and mathoms on the street. The street market is a fantastic idea made possible by the high […]

Eadaoin takes photographs at La Maison d’Érasme, Anderlecht

Belgian railway platforms

The first is a different angle on Platform #12.

Eadaoin at Spanish Point, September 2016

Taken the day after Maria’s wedding. Sore heads abounded.

Oisin

Eadaoin and I were in Brussels to meet her nephew Oisin, who turned out to be an awesome little kid full of life and wonder at the world.

Dawn from Windy Arbour

The last couple of weeks make me feel like my photographic mojo is on its way back.

Cookie in the kitchen

She quickly decided she was through with my shit.

Bank holiday Monday at Knocksink Forest

Eadaoin looked beautiful, I looked like a bum.