🇵🇸 Donate eSIMs to Gaza 🇵🇸

#coding Notes

Subscribe with RSS or follow me on Mastodon!

↩ All Notes
  1. (Permalink)

    #coding #webdev #debugging #nodejs

    TIL that Chrome has a great built in Node JS profiler.

    You can connect the Chrome debugger to your Node code, and get Performance metrics just like you can with a website!

    See https://developer.chrome.com/docs/devtools/performance/nodejs for full instructions.

    One tip is that you need to add a timeout before the code you want to profile, so that you have time to hit the Record button in the DevTools “Performance” tab.

    This helped me narrow down what had been making my blog generation scripts run slower. It’s a nice debugging experience!

    Discuss on Mastodon
  2. (Permalink)

    #coding #css #webdev

    Tip for sorting lists using CSS!

    If your list is initially sorted, you can reverse it by using display: flex and setting the flex-direction attribute to column or column-reverse.

    For example:

    ol {
        display: flex;
    
        /* flips the order */
        flex-direction: column-reverse;
    }

    Then you write a little bit of Javascript to change the flex-direction when the user selects a dropdown option and voilĂ , sorting!

    Now my /notes page can be viewed with the oldest notes at the top 🤗.

    Discuss on Mastodon
  3. (Permalink)

    #coding #rss #indieweb

    And now I’ve gone down a rabbit-hole about the <link> rel attribute!

    Turns out, in 2006 whatwg added a “feed” type to the rel attribute, which would be used like this:

    <link rel="feed" href="/feed" title="Articles">

    This was from an era when tech companies, to different degrees, were actually supporting RSS.

    For example, Firefox and IE had a feature called “RSS Autodiscovery” where they would show a little button when a site had a feed. When clicked, the site’s feed would get added to the user’s RSS reader, which was built-in to the browser.

    The intent of the rel = "feed" syntax was to allow Autodiscovery of <link>s that were syndication feeds, but that had non-obvious MIME types.

    From whatwg’s blog post announcing the feature:

    “For example, hAtom uses regular HTML with the MIME type text/html, yet may still be used as a syndication feed format.”

    Alas, it never got widely adopted, maybe partially because rel="alternate" worked fine, and maybe because Chrome never implemented Autodiscovery. Whatwg removed it in 2009, only three years later.

    Still, it’s an interesting glimpse into a past not so very long ago where RSS got serious attention in the Web Standards space.

    I long for the world where RSS stayed in the mainstream, instead of being buried by the enshittified, algorithm-driven, profit-mad social media feeds we’re all addicted to now.

    But, hey, if we try hard enough, maybe we can still make that world. Maybe they tried to bury RSS, not knowing it was an indieweb seed :)

    Discuss on Mastodon
  4. (Permalink)

    #coding #rss #indieweb

    I was just reading Taliesyn Walker’s post about RSS and TIL that you can add a <link> element to your website that points to your RSS feed!

    It looks like this:

    <link rel="alternate" type="application/rss+xml" href="<your rss link here>" />

    This allows RSS readers (and search engines) to more easily find your feed. Neat!

    Discuss on Mastodon