Rails: Monkey patching TimeZone logic

I’ve been working with a third party API to import some data, but only if one of the fields effective_date is today or in the past. So with

[ {
    data: {...},
    effective_date: now
  },
  {
    data: {...},
    effective_date: tomorrow
   }
]

the first record will be imported while the second record will be skipped. This is fairly easy to write a spec for, but for a project manager, or a tester who is manually doing experience testing it’s kind of hard to know if the record with an effective date tomorrow is going to import when tomorrow comes.

I’m sure there are libraries for this and strategies but I put together a little monkey patch for this scenario:

module ActiveSupport
	class TimeZone
		def now 
			Time.now + 1.day
		end 
	end 
end

I sent that over to the PM with instructions on where to put it (essentially, anywhere). Now, I realize this is not a good idea, and will likely mess up all kinds of stuff in Rails but for a one off test it worked perfectly and is still faster than signing into the service (which we may or may not have access to) and updating the effective_date.

Every year I get pumped for Advent of Code. Then however long the first day or two takes me I start to think of all the other things I could/should be doing with my time and it peters from there. Sigh, I love the idea of it, maybe sometime I’ll take a sabbatical in December and dedicate myself to it.

My wife and I have started painting our Christmas cards. I’m a big fan of Owen Pomery’s style, it kind of reminds me of Hergé. I copied this from Victory Point

I was telling my wife about the raccoon who broke into a liquor store, got drunk, then passed out in the bathroom. She said, “Sounds like an American racoon”, I guess he truly was living the American Dream.

If your worried, they sobered him up in the drunk tank and released him safely into the wild a few hours later.

No More Tears

Finished reading: No More Tears: The Dark Secrets of Johnson & Johnson by Gardiner Harris 📚

I love a good expose on unchecked corporate greed. I’d say I’m not surprised because there are no depths to which unchecked capitalism won’t sink to but there were a few takeaways in this book that shocked me:

  1. J&J was conducting tests on black prisoners up to at least 1971, that’s nearly 30 years after the Nuremberg Trails!
  2. I was breathing in asbestos anytime I used J&J baby powder. Years ago I heard that talc was not good for the lungs, but I didn’t realize that all talc has trace amounts of asbestos due to their similar chemical makeup and co-location.
  3. J&J actively sold unapproved drugs in the optimistic hope that the FDA would approve them and thereby give a retroactive taciturn approval.
  4. Although Purdue and the Sackler family are the public face of the opioid epidemic; J&J has, outsold Purdue with subsequent opioids running the same marketing playbook that “this time it’s not addictive!” Not only that, but all the opium Purdue used to manufacture their opioids was supplied by… J&J.

My daughter really wanted to watch “A Charlie Brown Christmas” for our November movie night, you can’t rent it you have to subscribe to Apple TV to get it. This gives me at least 1 month to binge all the Apple shows people talk about. We are working our way through Severance.

Wonderful to see this from James Cameron:

…you’ve got generative AI, where they can make up a character. They can make up an actor. They can make up a performance from scratch with a text prompt. It’s like, no. That’s horrifying to me

He’s a futurist who has always embraced cutting edge technology in his films but only in service of the story, pushing the limits of his creativity and the creativity of those he works with. Generative AI will never do that; because it is not creative. Computers can not produce art.

Olympic Logos

I’m no lover of the Olympics but the branding behind them fascinates me (see 99pi Mexico 68). This morning I stumbled across some hate for Utah 2034 and all I could do is shake my head; to be an Olympic Logo designer, what a thankless job in it’s time. I think the general trajectory of an Olympic logo is this:

  1. Unveiling: everyone hates it and loudly proclaims this
  2. Lead up to the games: through repeated exposure the image is rehabilitated in people’s minds
  3. Immediately following the games: people mostly have positive associations with it
  4. Legacy: this is where the timeless/iconic nature of the logo is actually proved. Will people remember it in 30 years? 50 years?

In general people hate new logos, anytime a company changes their logo there is going to be backlash which is why, it’s best to just keep moving forward and ignore the chatter for a few months. The Olympics are unique because the logo (and associated iconography) for each games is both a “brand new” logo but it’s also an iteration or a “redesign” of all previous logos. Of course, Utah is not Vancouver, or Turin but when people see this logo their mind is going to think of those logos and do, likely, the same thing it would for a corporate rebrand.

Personally, I think Utah 2034 is dope. Although, I might have skewed something in the A or H to avoid the 4 leaf clover look they’ve got going on.

Utah 2034 Olympic Logo