DEV Community

Jérôme Gamez
Jérôme Gamez

Posted on

After more than 20 years as a professional developer, I published my first dirty Open Source project

I've been a professional developer for more than half of my life, and an Open Source advocate since GitHub came to be.

When people ask me "But Jérôme, I'd be embarrassed if anyone saw my code. They would think I'm a bad developer", to which I'd answer that somebody will find useful, practice is progress, and they might get valuable feedback.

However, I never followed my own advice. When I publish an Open Source project, it has to be "serious", I'm a professional developer and that has to show.

A few years (three at the time of this post) ago, I reported an issue I had in the (Open Source) RSS Feedreader of my choice, NewsBlur.

The categories of RSS feeds from my bookmarks service, Pinboard, were all concatenated to a single string instead of being displayed separately.

I'm subscribed to the Pinboard Popular Feed. It provides posts that have been bookmarked by other Pinboard users and allows me to learn about topics I would otherwise not be aware of.

As categories, among other criteria, are used to filter articles in NewsBlur (my favorite feature), this made it difficult to train Pinboard feeds to not show the ones that don't interest me.

Last week, I had a little bit of time and decided I would finally tackle this.

I first tried it the "professional" way: I wanted to create a PHP Pinboard SDK and then use it to parse the RSS feed and fix the categories.

As it turned out, parsing RDF XML feeds is not an easy task. The native way of doing it in PHP is cumbersome, and the libraries I tried were throwing errors.

I then remembered my advice from above and did what I never did before: I made it quick and dirty.

  • Instead of using an HTTP client, I used file_get_contents()
  • Instead of parsing XML, I used regular expressions. (You shouldn't do this
  • Instead of using OOP, I didn't

And guess what, it worked, and the code fits into one screen on my mobile phone.

Screenshot of the code on my iPhone 14 Plus

I added a GitHub workflow that runs the script and publishes the fixed feed to GitHub pages, and subscribed to that one in NewsBlur.

Done!

I'm sharing this here to prove my point, because it could be useful to someone with the same problem (as unlikely as it is), and because I'm actually proud that the code is dirty.

If you're interested, have a look at it, and fork the repo if you want to adapt the script to your feed needs.

GitHub logo jeromegamez / pinboard-for-newsblur

Fixing pinboard.in keywords to be displayed correctly in NewsBlur

Pinboard for NewsBlur

A proxy for pinboard.in feeds that fixes the keywords to be displayed correctly in NewsBlur, periodically published to GitHub Pages, so that I can subscribe to this feed instead of the original one.

Why?

pinboard.in is the bookmarking site that I use to store links I find interesting you can find mine at pinboard.in/u:jeromegamez.

I also use it for its Popular Bookmarks - I subscribed to its RSS feed in NewsBlur and always have something interesting to read when my other feeds are empty (they rarely are).

NewsBlur is my RSS-Reader of choice, mostly because of its Site Intelligence Trainer with which I can hide posts with certain keywords in their title and/or tags.

Unfortunately, Pinboard makes that hard by not publishing Story Tags so that NewsBlur can understand them. Instead of showing tags one by one, all tags are combined to one long keyword.

For…

And if you want to subscribe to my, always super-interesting haha, bookmarks, you can find them at https://pinboard.in/u:jeromegamez

Happy dirty coding!

PS: This post follows the same principle: I wrote it on my phone, it has probably some typos and semantic errors, but I can revisit it later - or keep it as it is, because it already transports what I want to say.

PPS: Point in case, I had a typo in the title and that typo will be in the post URL for all eternity 🤷🏼‍♂️.

PPPS: I'm on a Mastodon, too!

Jérôme Gamez: "I published a dirty post about a dirty project I …" - PHP Community on Mastodon

I published a dirty post about a dirty project I published: https://dev.to/jeromegamez/after-more-then-20-years-i-published-my-first-dirty-project-1amn Oh, I had a typo in the title and now there's a typo in the URL. Forever! Well... 🤷🏼‍♂️ #OpenSource #PHP

favicon phpc.social

Top comments (0)