Itty Bitty Rants

Infrequent posts about stuff.

  • Mocking Indirect Variables

    I have been working with an API that returns some extra info in the response headers and so was looking forward to getting a lot of mileage out of the new -ResponseHeadersVariable parameter for Invoke-RestMethod, but as I was writing tests for my new functions I ran into an issue: How do you mock setting that kind of variable? Turns out the answer was pretty simple, just use the old trusty Set-Variable function with the -Scope parameter.

    Read more…
  • Finally A New Soda Review!

    If people know me at all it’s for one of three things: LEGO, DevOps, or Soda. After posting several hundred short reviews of soft drinks to Twitter over the past decade the hardest thing after quitting that platform last fall was setting up a new system for posting my soda reviews. I had been planning on setting up a website for many years to collect all of my reviews but had never actually gotten around to doing it.

    Read more…
  • New-MockObject and a Misleading Error

    The joy of writing unit tests sometimes is making sure that you can properly mock the interaction with other systems, especially systems that might be really expensive if you had to hit them every time you wanted to run a unit test. Obviously mocking function calls with simple $true and $false values will get you most of the way there, but sometimes you need to return an object from those mocked calls and for that New-MockObject can be a lifesaver.

    Read more…
  • Pretzels!

    I made pretzels for the first time yesterday! I was expecting them to look like a complete mess and possibly not even identifiable as pretzels but over all I think they turned out pretty good for a first attempt. I used the Alton Brown recipe and it was pretty simple to follow, even though their site is a huge mess. My first batch of pretzels A couple of notes for next time:

    Read more…
  • I Quit Twitter Today

    The week before the US election I decided I was going to take a break from Twitter for at least two weeks. In order to make that decision actually stick I even went as far as uninstalling the app from my phone. For the following several days I found myself randomly picking up the phone and mindlessly unlocking and tapping where the app icon had been. It was kind of enlightening about how I had been using it and how it had been fitting in to my day to day.

    Read more…
  • Is This Thing On?

    This is just a post to see if IFTTT integration is working to automatically post to my Twitter account…

  • Some Migration Notes

    As I mentioned in the previous post I am hosting this blog on Azure Static Web Apps now using Hugo as my generator. That transition was definitely not without quite a few bumps along the way. I first started to work on this transition about 4 years ago when it was necessary to generate quite a bit of Azure infrastructure to make it work, including some hacks to make default pages for folders work properly, so it never quite got done until today.

    Read more…
  • Finally!

    It’s been a long time in the making but I have finally transitioned this site to a static generated site being hosted on Azure. This past spring at Microsoft’s Build conference they released a new product in preview called Azure Static Web Apps that HUGELY simplified setting this up. It’s kind of funny because the previous weekend I had finally gotten back to starting to work on this transition and had gotten some build pipelines setup for all of the terraform for the infrastructure and now it turns out that absolutely none of that is needed anymore!

    Read more…
  • Dusting off the cobwebs a bit

    Over the past couple of years since I last added a new post to this blog I’ve been halfheartedly working on converting from WordPress to one of the modern static generators but luckily a recent involuntary, but somewhat welcome, change in employment has freed me up to finally (hopefully) make some progress on that front. With any luck I’ll have the site updated to new hosting and back-end by the end of the year.

    Read more…
  • Differing output from Where and Where-Object

    One of the lesser known features of PowerShell are some “magic” methods that get added to most (all?) collection objects that replace the slower Where-Object and ForEach-Object cmdlets with basically the same functionality. They’re considered magic because they aren’t well documented even years after they were introduced. (Thank goodness for bloggers) I’ve used ForEach quite a bit, but often forget about it’s Where counterpart and apparently had never actually done much with it until today when I ran into a weird issue where I couldn’t set the value of a property on a returned object.

    Read more…