Automatically add vendor prefixes to properties and values in Sass

in code

I came up with this myself and discovered after that other developers came to exactly the same solution for the problem of vendor prefixes. CSS3’s flexbox is the newest greatest thing in my life. It makes incredible sense and lets me do things like:

  1. Vertically center child elements and other content without having to use hacks like one-line-of-content-with-a-huge-line-height or absolute positioning coupled with matrix transforms.
  2. Dynamically add columns to a container without having to individually resize each column.
  3. No more fucking floats.
  4. Evenly space content, period.

It’s great, and support for it is still incomplete. When I worked on the new Ouro site last week I ran into the problem that content collapsed or looked strange on Eadaoin’s borrowed (thank you!) iPhone and iPad. In mobile Safari, even on iOS 8, flex-related properties and some rules* still require vendor prefixes, so I wrote a pair of Sass mixins to add those prefixes for me:

@mixin prefix($property, $value) {
    // Automatically add vendor prefixes to a CSS property.
    // Mozilla Firefox.
    -moz-#{$property}: $value;
    // Microsoft Internet Explorer.
    -ms-#{$property}: $value;
    // Webkit Browsers (Chrome, Safari);
    -webkit-#{$property}: $value;
    #{$property}: $value;
@mixin prefix_value($property, $value) {
    // Automatically add vendor prefixes to a CSS value.
    // Mozilla Firefox.
    #{$property}: -moz-#{$value};
    // Microsoft Internet Explorer.
    #{$property}: -ms-#{$value};
    // Webkit Browsers (Chrome, Safari);
    #{$property}: -webkit-#{$value};
    #{$property}: $value;

The output CSS can be a bit messy, and so if performance of your CSS is a concern then you will need to add browser detection and then write a separate set of rules for mobile Safari.

* This was a strange one, but apparently other such cases exist. Where with other rules I had to prefix the property (before the colon), with display: flex I had to prefix the value, after the colon, to be display: -webkit-flex;.

So I saw an eclipse

in astronomy

Any personal blog-this blog-is run out of its controller’s own desire and creativity. Lately I’ve discovered that when people begin to depend on me to provide both of those on demand, on a daily basis, my spontaneous application of them to the blog goes out the window.

I could blog snippets of code or talk about my novel solutions to tricky problems; a thousand other coders and tech evangelists do that daily, and do it in more depth than I ever could. Might be that I could rant about my perpetual heartbreak over the kids; that doesn’t serve anyone or fix anything, so eh. Or maybe I could talk about Eadaoin; I’d rather talk to her and appreciate what I have. Or possibly photographs, except I have no phone (but 3 look to be shifting their arses on this at last).

And, truth be told, I just couldn’t be bothered because that’s the point of my site: I can walk away when I want to and come back when I feel like it.

Yesterday was the occasion of a solar eclipse that was visible across north west Europe. It was the first eclipse visible from Ireland since 1999, and the last visible before 2026.

The eclipse was beautiful, truly gorgeous, and left me with a lot to think over. Ireland (well, I) missed the 1999 eclipse. I remember that it was a heavy and overcast day, and that I was at work in Dunne Stores in Galway. While we all got up on the roof for it, it was already so gloomy out that there wasn’t anything to see. We all knew, consciously, that it was darker, but we couldn’t feel it.

Yesterday’s eclipse was much more spectacular. To paraphrase a book I once read, you can live with a prophecy all of your life, but the unpredictability of the moment of revelation can still leave you unprepared. Such was yesterday morning: it’s one thing to know about solar eclipses from the pages of a book and another to actually experience one. They aren’t comparable.

The Galway Astronomy Club had a viewing stand set up on the promenade on Salthill behind Seapoint by the sea. A goodly crowd turned out; I’m going to pick number out of my ass and say there more than a hundred but fewer than three hundred present.

I got to show a family how a camera obscura works, and watch their own moment of realization. With them, it was with a paper plate. They brought two plates with holes punched through and no idea of how they were supposed to look at the sun through them. I demonstrated how to arrange the plates and then move one back and forth to focus the image. “That’s like a camera!” their mother exclaimed. I did good, it felt good. :D

I met a few friends in the crowd, Christopher among them out flying his hexcopter to record the moment. I told him, “you can’t fly closer to the sun to make it look bigger in the camera”, but did he listen? Did he, my arse.

My own moment of realization was with the solar corona. I read over and over that “the solar corona is between one and four hundred times brighter than the surface”, but didn’t grasp the reality until ninety percent of the sun was eclipsed by the moon and that whole area of the sky was still too bright look at directly.

There were other “oh, wow” moments through the morning, starting when I left the house. For all that the skies were clear, it felt dark. I thought about why that might be, for a second…

Right at the peak of the eclipse, at 9:30, I looked around to see if I could spot any planets. Although it was way, way too bright to spot any stars, under the right light it is possible to spot Venus and Jupiter during the daytime if you know exactly where to look. Once I got into the practice of it I was able to find Venus in the daytime sky in winter as early as 1:30pm on a clear afternoon. Christopher helped out with a star map application. Sadly, Venus and Mercury are both down close to the sun right now, lost in the star’s glare, while Jupiter is close to opposition, over your shoulder and behind the earth as you stand and face the star.

It was dark at the peak. Everyone in the crowd felt the moment. The sky was a very beautiful shade of blue, and thick fog lay over the Burren. Gleninagh Mountain, overlooking Black Head, barely peeked its head out. Galway was quiet and the breeze off the sea was up. There was a palpable chill in the air.

It’s right around then that a lot of people feel the supernatural; either the hand of or the presence of God. I’m not spiritual. I’ve never felt any such stir in me. More that I felt that we are very, very small pieces of a much larger, stranger and beautiful universe. Day to day, we focus on whatever is in front of us. Occasionally the larger, stranger and beautiful universe will reach down to poke at us. What I felt yesterday was exactly that: prodding by the bigger universe. I felt small, but as a small part of a larger system.

Oddly enough, a lot of people who go into space report the same. Andrew Chaikin’s A Man on the Moon relates stories from several Apollo astronauts has an affirmation of either their religion or their place in a bigger universe while on their way to from the Moon; Chris Hadfield touches on it in too in An Astronaut’s Guide to Life on Earth; and, famously, Carl Sagan recounted his thoughts about the eponymous photograph in Pale Blue Dot.

Even the most hardened atheist will feel something when they look out the port of their spaceship.

I have no camera, so I will close out with a few photographs of the eclipse taken by weather satellites:

Eclipse over Europe, courtesy of sat24 Eclipse over Europe, courtesy of sat24

Operation: Break the Site II

in the website

List of related articles on the site

It’s going pretty well; I’ve covered most of my initial goals, and now I am taking further steps to pad out content across the site by adding a list of related posts below each article:

$related_posts = new WP_Query(array(
    'post_status' => 'publish',
    'cat' => $category[0]->cat_ID,
    'posts_per_page' => 20,
    'orderby' => 'rand',
    'order' => 'DESC',
    'post__not_in' => array(
    'date_query' => array(
        'inclusive' => false,
        'after' => get_the_date('Y-m-j') . ' -180 days',
        'before' => get_the_date('Y-m-j') . ' -7 days',

Pick ten posts from the same category, in a range between 7 and 180 before the date of the post, and output three random ones.

Here is no water but only rock

in me

There’s been a lot of uncertainty about where life will take me, but that’s been understandable. I mean, if you look back in to 2013 and 2014 I was mostly a fucked-up mess of a man who could barely get out of bed in the morning let alone say “this is where I want to be in five years.” But everything passes; now I have a small (read: tiny) freelancing business, an estranged ex-spouse and a girlfriend, all of whom come with the important requirement that I forward plan. Eadaoin likes to work within a framework of plans, my income needs a chart to avoid the feast or famine cycle, and everything with my ex-wife requires preparation and forethought.

So I’ve learned to plan at the small levels. But where do I see myself in five years? That has been the question I’ve avoided. On Tuesday I met a Galway solicitor through the Legal Aid Board to discuss the Kid Situation, and tonight I had a VOIP call with a Boston-based immigration attorney. The details of the Tuesday meeting can stay between the solicitor and I, but I’ll say that she gave me great advice and I acted on it. The gist of the meeting is that I’ve made a lot of the right decisions, and any final outcome is still years away. In the meantime I need to keep my head down, my mouth shut and my eye on the goal of the kids.

Less Good: today’s VOIP call. I cannot reenter the United States until November 2019, and on that occasion I will require a visa. I’m not stuck in Ireland or even on this side of the pond (\o/ Canada \o/), but at the end of the day I can’t be where I want to be.

Neither meeting has left me disheartened; quite the opposite in fact: I know precisely where I stand, when x or y will occur, how I might reach z goal and what might happen when I get there.

Here I stand; there I go.