Payton.Codes

Musings on life, games, and code

Blog

  • The Witch’s Secret

    Per tradition, I wrote a one-shot D&D adventure for my co-workers during our Fall meetup this year. The player characters are residents of the city of Krayina Tiney, a city plagued by monsters for one month out of every year. This has led to a robust organization of witches, warlocks, and monster hunters who protect…

  • Elegant error handling in Rust

    I’m slowly becoming more proficient working in the Rust language. I’ve now made my third tool, a command-line task manager called fini, and I’m starting to see the patterns that work well. One of them that I really like is how Rust provides convenient ways to handle errors. I think that other languages could really…

  • Using PHP property hooks wisely

    PHP 8.4 included a new feature for class definitions called “property hooks“. These are a way to dynamically control the behavior of property reading and writing an object property. To put it another way, they let you turn property access into method calls. This is something that many other programming languages do, and it’s nice…

  • Grappling vine animation

    When I designed my game, The Lost Card, one of the powers I had come up with was a sort of extending vine that acted like a grappling hook, able to pull the player toward specific rocks on the map. However, with my limited game development experience, this proved way too difficult. I was able…

  • Running a flashback episode

    My regular weekly D&D game was on hiatus for a month because of random adult things. A familiar story, I’m sure. Our group is small, so even one player not able to make it generally means that we can’t play. Usually that’s fine, but occasionally the absences stack up and we miss a whole bunch…

  • The making of phpcs-changed

    Automattic developers have always held the WordPress PHP coding guidelines as the basic advice for writing WordPress.com code. However, when I started in 2013 most of the code I actually encountered in the codebase did not follow those guidelines. When I transitioned to my current team around 2016, the codebase had no automated linting at all. Having seen…

  • Refunding linked subscriptions

    Today I wanted to write about another work project that’s taken up a lot of my time: how to properly refund subscriptions that were paid for over multiple transactions. Refunding an upgraded subscription Let’s say you sign up for a subscription at a service’s Basic tier for $10, and then later upgrade that subscription to…

  • The Receipt Item Tag Trick

    I’m not sure I should be proud of this solution, but I wanted to discuss a technique I invented to solve a tricky problem at work. Our billing receipt database records have a separate table called “receipt tags” which are just simple strings that can be associated with a receipt. These are useful for all…

  • Commas and periods make cents

    A long time ago (relatively speaking), all prices displayed to users on my company’s website were rendered from their numeric data (like 10.25) into a formatted string in PHP (like £10.25) and then passed along to the client. As our frontend began to have more complex requirements for the way prices were displayed, this was…

  • Thirty days hath September

    Here’s a riddle for you: what’s one month past January 31? Is it February 28, the end of the month? Or is it March 2, thirty days ahead? Or March 3, thirty-one days ahead? There’s no correct answer. So if you signed up for a monthly subscription on January 31, or on October 31, or…

  • Mask of the Many

    As per tradition, I’ve written another D&D one-shot adventure for my friends. I recently had the pleasure (or displeasure?) to watch the Mystery Science Theater 3000 episode, The Pumaman. It was hilariously bad (good?) and I wanted to somehow capture its glory into an adventure. This is what came from it. I hope you enjoy……

  • Music for The Lost Card

    When I was working on my game, The Lost Card, this summer, I had never planned on having sound effects, let alone music. But as the game’s final touches came together, I found the time to do both. I wanted to write a little about the process. The sound effects came together pretty quickly, thanks…