• 0 Posts
  • 22 Comments
Joined 1 year ago
cake
Cake day: June 15th, 2023

help-circle




  • 418teapot@lemmy.worldtoProgrammer Humor@programming.devaverage day in NPM land
    link
    fedilink
    English
    arrow-up
    35
    arrow-down
    4
    ·
    edit-2
    1 month ago

    It’s kind of insane how bad this whole is-number thing is. It’s designed to tell you if a string is numeric, but I would argue if you’re ever using that you have a fundamental design problem. I hate dynamic typing as much as anyone else, but if forced to use it I would at least try to have some resemblance of sanity by just normalizing it to an actual number first.

    Just fucking do this…

    const toRegexRange = (minStr, maxStr, options) => {
      const min = parseInt(minStr, 10);
      const max = parseInt(maxStr, 10);
      if (isNaN(min) || isNaN(max)) throw Error("bad input or whatever");
      // ...
    

    Because of the insanity of keeping them strings and only attempting to validate them (poorly) up front you open yourself up to a suite of bugs. For example, it took me all of 5 minutes to find this bug:

    toRegexRange('+1', '+2')
    // returns "(?:+1|+2)" which is not valid regexp
    



  • Agreed, but my point is with a centralized network the lowest common denominator wins. There is no reason you can’t have QoL features on an open network, and thusly let everyone have the features that they care most about.

    Can you imagine what a shithole the internet would have been if email wasn’t federated an open? There is absolutely no way that whatever centralized bullshit would have spawned instead would already be either long gone or enshittified to the point of being useless.


  • Good for you, you have a short list of requirements out of a chat service and discord perfectly fills your niche. But different people have different requirements for chat, and they don’t align. And network effects force people who have differing requirements to use the service with the most users which sucks.

    For instance here are things that I require from any chat service that I use that discord completely falls flat at:

    • Ability to run it on my linux machine without using an electron client (npm is a huge mess of supply chain attacks and I refuse to run any software that is likely to contain dependencies from it)
    • Ability to run it on my AOSP phone which does not have any google play services installed
    • Ability to write software to back up messages without fear of a company changing their API and breaking my backup system







  • I haven’t used any flatpacks, mostly because they don’t seem to have a good solution for running terminal programs. (Also I don’t like that the application developer chooses the permissions to expose rather than the user.

    However, I have been using bubblewrap which is what flatpack uses under the hood to sandbox. This allows me to run both gui and non-gui programs, and I have the control of exposing the minimum required permissions that I’m comfortable giving an untrusted piece of software.


  • I seem to be in the minority here but I personally prefer using $ and # to denote root. I like this because not everyone uses sudo and might not even have it installed.

    That being said, if you already have other commands that are using sudo -u ... to run commands as a different user then it might be best to just be consistent and prefix everything with it, but if there is only a few of those maybe a # cp foo bar && chown www-data bar is an alternative.



  • The way I remember the order is that the parentheses around the link would make grammatical sense outside of markdown (the goal of markdown is to still be fully readable even when looking at the raw source).

    For example if I were posting on a forum that didn’t have markdown support which one of these would make more sense:

    1. You can find that on this lemmy instance (https://lemmy.world).
    2. You can find that on (this lemmy instance) https://lemmy.world.

    Option 2 makes no sense grammatically. Then you just need to use the square brackets (which rarely show up in non-markdown text) to denote the link range.


    Alternatively, if you still have a hard time remembering the order, you can use reference-style links which make it even more readable outside of markdown rendered contexts (note that there are no parentheses in this version, nothing to get confused):

    [Here is a link][1] and [here is another link][2].
    
    [1]: http://example.org
    [2]: http://example.com
    

  • Invidious is just a frontend to Youtube like Teddit was a frontend for Reddit. It’s not federated, and Google can and will do everything in their power to make it suck. Just like how Reddit will now destroy Teddit next month.

    Peertube is the federated option for video hosting/sharing. But of course, like everything else currently controlled by the centralized mega-corporations, there is a huge network effect hurdle that users need to overcome to get their content off of the user-hostile megacorporations (Youtube) and onto the federated alternatives (Peertube).

    I see invidious/teddit/nitter/quetre/rimgo/scribe/libremdb as stop gap band-aids to temporarily give power back to the users, but in the end the owners of the content have full control over stopping these.

    This is why it is so important that we promote federated networks like lemmy, mastadon, matrix, peertube, etc… Otherwise the entire internet will be a user-hostile cesspool.