• MyNameIsRichard@lemmy.ml
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    I solved one of these once upon a time.

    There was a function that wasn’t called from anywhere in the project which if deleted caused the whole system to fail in test and (presumably) production at runtime. It turned out to be scripts for a cron job that were only on the servers. I moved them in to the project and thus version control. Mystery solved.

    • TheHalc@sopuli.xyz
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      Just make sure to add comments like

      //Magic, do not touch
      

      To make sure no-one accidentally breaks the spell.

      • echo@lemmy.ml
        link
        fedilink
        arrow-up
        1
        ·
        1 year ago

        If you even know which line of random bullshit you changed that made it work, that is

      • 𝘋𝘪𝘳𝘬@lemmy.ml
        link
        fedilink
        arrow-up
        0
        ·
        1 year ago
        // Do not delete! Yes, it's not used anywhere in the code, but if it is removed
        // the application crashes and the error code is useless for debugging.
        let f = 'a';
        
    • UnRelatedBurner@sh.itjust.works
      link
      fedilink
      arrow-up
      0
      ·
      1 year ago

      these things happened before chatGPT tho.

      I once wrote C code for a hangman game. I took in a character and checked if it’s matching with any of the hidden characters. Long story short I did not code what should happen when the user inputs more than 1 character, but during testing I realized that it just analyzes every chracter one by one, and if you input the same characters multiple times it would just ignore it ofc. Making it possible to type a single character, multiple if you wanna be risky. Or the whole word. I liked it better than if it would work on a “guess” basis because it was way more fun, so I kept it that way. Have no idea why it does what it did, but it works.

      better example is & and * in Rust. If someone tells me they can get them good the first try, TEACH ME, or they are lying. When it works it judt works don’t you dare touch them.