Payton.Codes

Musings on life, games, and code

Payton’s Blog

  • Legend of the Whale

    Legend of the Whale

    As has become tradition, every year I design and run a one-shot Dungeons & Dragons game for my co-workers at our annual gathering. This year I was heavily inspired by my experiences playing Breath of the Wild and I wanted to try to re-create that particular “Zelda” feeling in D&D. I’d love to have done…

  • Safely coding with constants

    Safely coding with constants

    In PHP there is a tendency to assume that the code we are working on is the only code that is running. The global and transactional nature of the language’s past has made this easy to do. This tendency naturally leads us to use global state, and while there does seem to be a resistance…

  • Giving more time to each thing

    Giving more time to each thing

    Lately a lot of my dharma practice has been revealing restlessness. Even when I think I’m being calm and slow and contemplative, I still am giving more thought to my Instagram-mind, or my what-do-I-need-to-do-next mind. Most of all I’ve noticed that my inclination toward efficiency in all things leads me to always be doing more…

  • Creating Sniffs for a PHPCS Standard

    Creating Sniffs for a PHPCS Standard

    As a follow-up to my summary of using phpcs to lint your PHP code, this post will explain how to create, modify, and test a phpcs standard. As a quick refresher, phpcs organizes its linting messages (warnings and errors) into “sniffs”, then into “categories”, then into a “standard”. The official tutorial for creating a standard…

  • Linting PHP with phpcs sniffs

    Linting PHP with phpcs sniffs

    Linting is the process of using an automated tool to scan your code for problems before you commit and deploy. It is a practice widely used in the development workflow of many languages, but hasn’t much been used in the PHP of WordPress developers. The most commonly used linter in PHP right now is called…

  • Maybe returning errors in PHP

    Maybe returning errors in PHP

    A common pattern I see in WordPress PHP code (and probably other PHP code) is a function which does some operation on data and returns a value. For example, a function which makes a database query and then returns the resulting row. In order to make more robust code and prevent bugs, I’ve been systematically…

  • Functional Dependency Injection in PHP

    Functional Dependency Injection in PHP

    Having become used to the convenience of passing first-class functions around in JavaScript to make other functions decoupled and easily testable, I was wondering if we could do the same thing in PHP. Of course, PHP technically has first-class functions as well, but the syntax is a little awkward, since the functions must be referenced…

  • Thoughts on Privilege

    Thoughts on Privilege

    Today in my Sangha we explored the concept of Engaged Buddhism, particularly as it applies to race, gender, and class. We explored the most insidious aspect of privilege in our society: that those with privilege do not see it; we are blind to it. White people do not consider race to be a primary factor…

  • Search for the Sage

    Search for the Sage

    My fourth D&D adventure crafted for the Automattic Grand Meetup, Search for the Sage is a one-shot game perfect for new and experienced players alike. It runs in about 3-4 hours. I had a lot of fun creating and running this one! Huge thanks to the many friends who played through this adventure and extra…