-

Declarative vs. Imperative: asking for soup vs. making soup
A little while ago I wrote a post about my concepts of declarative vs. imperative programming. I ended that article by saying, “I can’t wait to see what I’ll learn next.” Well, I’ve found another definition which has been very helpful to me lately. Also, I’m a little worried that it might actually be the…
-

Lightweight rendering of React to strings
For a recent project I needed to be able to render React components (or really, just React-like components) into plain HTML strings. Of course, React provides a mechanism to do this: renderToStaticMarkup in its ReactDOM library. But wow, that library is a really big dependency to import if I don’t want any of the DOM reconciliation…
-

PHP Unit Testing and Pad Thai
As a follow-up to my last post about PHP unit testing, I recently gave a talk at WordCamp Boston about how to write testable WordPress plugins. You can see the talk slides here: https://payton.codes/testable-wordpress-plugins/ You can also watch the talk here, although the audio quality isn’t great. The premise of my talk was mainly that…
-

Temple of the Ruby Sands
A year ago I published a Dungeons & Dragons adventure titled The Stonecutter Samurai which was written to share with my friends and co-workers at Automattic. This year I wrote another adventure, Temple of the Ruby Sands! As it has now been played a total of seven times and I’ve cleaned up the stats and…
-

Higher Order Components and Pie Recipes
Higher Order Components (“HOCs”) are the latest hotness to come out of the JavaScript idea world and land in our apps. React apps, anyway. I really want to write: Higher Order Components are just wrappers, but that would be simplifying the concept too much. Wouldn’t it? Maybe. Anyway, they’re wrappers. Keep your actual Component simple…
-

Power and Love
Here’s a quote by Martin Luther King Jr. that I learned today and I really feel compelled to share: Power without love is reckless and abusive, and love without power is sentimental and anemic. Power at its best is love implementing the demands of justice, and justice at its best is power correcting everything that…
-

Test spies in PHP
I think that I wrote my first unit tests in Ruby with RSpec, back in the day. But I learned most of my testing knowledge from working with mocha and chai in JavaScript. One of the things that I learned from these tools is that being able to express your test logic in clear, nearly-natural…
-

An iframe without a url
Sometimes you need to display html inside an iframe, but it’s not at a URL. Perhaps you got the markup from an API endpoint or generated it yourself. Maybe the markup is from a different domain and you need to be able to manipulate its DOM without cross-origin errors. For all these reasons, I created…
-

Declarative vs. Imperative Soup
I remember not too long ago (I think this was about the time that React first came out) I was trying to understand what people meant when they said that it was “declarative” vs. “imperative”. Looking up the terms at the time didn’t enlighten me much. Mostly articles seemed to focus on the difference between…
