A slow grid in a Flask app I maintain had an obvious suspect. The biggest cost was Python re-checking 134,000 objects that would never be freed.
I added a small shield badge showing how many months someone had won a challenge. On my own profile, with one win, it said 21. The sample render I had checked it against said 1.
Python's random module is the wrong tool for passwords, and swapping it for secrets is only most of the fix. The shuffle at the end catches people out.
The nicest idea I met while building boot.dev's static site generator: parse inline Markdown by splitting on the delimiter and alternating, and get validation free from the section count.
I wrote fade-out code for explosion particles in a Pygame project, and it looked fine to me for months. It never faded once, and the reason is a quiet rule about how Pygame draws.
The guided version of Asteroids moves the ship directly: press a key, move; release, stop. I wanted it to feel like space, which meant momentum, and momentum turned out to need a compromise.