One of the greatest software I ever wrote was also the shortest.

Back in the early 2000s, I was hacking away with Linux in Peru, where SUNAT, the government’s online system to generate invoices only worked on Internet Explorer. Very much expected, always disappointing.

I grew tired to needing to boot up Windows just to make an invoice, so I dug into the mess. Turns out, the whole thing hinged on a quirk: the site leaned on an IE bug/feature that let them select form elements with `getElementById()` using the name attribute instead of the ID.

At the time, Firefox had the ability to add custom code to any site… or maybe it was a popular extension?. In any case, I made this script that added ID attributes to any element with a name but no ID, when you loaded a page of that site. It was four lines of code, max, but it worked great. And it kept working for several years until they finally fixed the site.

That little extension hit hard among the super niche Peru’s freelance-linux-users crowd. I even met two people that thanked me for it, which was a first.

The funny thing is… I was actually very ashamed when it happened. I’d shrug it off, mumbling, “It’s just four lines of code”. Felt like the biggest fraud for getting props over something so simple.

It took me a while to outgrow that mentality. Those four lines? They weren’t “short”. They were perfect: bug-free, lean, and did exactly what they needed to. In a way, the best code I have ever wrote.