on haystacks

October 9, 2019 @ 13:10

Go doesn't have a built-in function for finding an object in a list. I found this in some code at work:

// Checks whether an element exists in a slice of integers
func contains(haystack []int, needle int) bool {
 for _, n := range haystack {
  if needle == n {
   return true
 return false

I'm quite amused.

Testing Hugo

August 23, 2019 @ 22:56

Right so, does this work?

I'm using Hugo now. It's been... a bit of work. But the whole thing renders in 1.4 seconds, as opposed to the old Jekyll site which took 22.

While I was at this, I did some more moderninzing.

Little changes:

  • Post timestamps changed
  • Posts are now using the HTML <article> element, complete with the <header>, <main>, and <footer> sections.
  • Navigation bar uses the HTML <nav> element
  • Tag list now uses <ul> and <li>
  • I've changed to using the CSS ::after pseudo-element to put the bracketry around the menu items and the items in tag lists. Why? It sure makes the HTML look cleaner.
  • Many pages which used files ending in .html no longer do, I guess this is what Hugo calls "pretty" URLs. Sure, why not.

Bug fixes:

  • The first month in the archive sections is not duplicated like the Jekyll site did
  • The main image in the gallery isn't pushed up into the menu

To do still:

  • Make the gallery's filmstrip scroll to keep the current selection visible - good idea Rachyl!


January 3, 2017 @ 09:53

Coworker Greg said something about the "bytiness" of files, when he was talking about their sizes. He was talking about file sizes, but my mind wandered a little bit down the rabbit hole of defining "bytiness" clearly.

So here's my interpretation of what that means, implemented in Go. Because sometimes I like Go. No, really.