Comment

Comment by fwlr

Ah, the perils of programming in plain text.

I couldn’t tell you if AI code assistants would write this, or catch it - ironically enough, “the perils of programming in plain text” is one of my stated reasons for eschewing AI assistance.

Given that the succinctness just bit me, I’m inclined to sacrifice it and go with

  // over the range 0..23, +1 gives the same result%2 as -1, and also handles edge case of 0
  const lastHour = new Date().getUTCHours() + 1
  …
  env.QUEUES[lastHour % 2]

Fundamentally I guess I was just objecting to doing arithmetic in the time domain to achieve negating a boolean.
parent fwlr 4 hours ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton