• mack@lemmy.sdf.org
    link
    fedilink
    arrow-up
    14
    ·
    6 hours ago

    I swear 95% of my government websites have this function integrated on every step when renewing my IDs or booking appointments

      • cally [he/they]@pawb.social
        link
        fedilink
        English
        arrow-up
        1
        ·
        5 hours ago

        perhaps i too will post code on the internet

        here is a shell script i wrote for automating filenames for markdown files (blog posts):

        code
        #!/bin/sh
        set -e
        
        datecmd="date +%Y-%m-%d"
        
        if [ -z "$1" ]; then
          printf "Post title: " >&2
          read -r title
        else
          title="$1"
        fi
        
        file="$($datecmd)_$title.md"
        
        if [ -f "$file" ]; then
          printf "Error: post '$file' already exists.\n" >&2
          exit 1
        fi
        
        ${EDITOR:-nano} "$file"
        

        im not sure why i made it since i could just look at what date it is and write it down manually in the file name, but i felt like doing that as a quick hack

    • bleistift2@sopuli.xyz
      link
      fedilink
      English
      arrow-up
      9
      ·
      edit-2
      9 hours ago

      TIL. I grew up with ‘suicide is bad, filicide is ok’. I guess the times are a-changin’

  • bleistift2@sopuli.xyz
    link
    fedilink
    English
    arrow-up
    16
    arrow-down
    1
    ·
    edit-2
    9 hours ago

    If your element has an id, you can just reference it from the window scope. The const page = is useless. Also the body has its own reference under document: document.body replaces document.querySelector('body')

    • dan@upvote.au
      link
      fedilink
      arrow-up
      27
      ·
      edit-2
      9 hours ago

      If your element has an id, you can just reference it from the window scope

      This is brittle, as defining a global variable with the same name (or the browser adding a API with the same name) will override it. This functionality was only kept for backwards compatibility with sites designed for Internet Explorer. The spec says to use getElementById instead.

  • mikazuki@lemmy.world
    link
    fedilink
    arrow-up
    8
    ·
    8 hours ago

    Don’t just override opacity with null , it will override whatever the original style was. Before setting to 30% you need to store the original value and restore that in the timeout.

    • bestelbus22@lemmy.worldOP
      link
      fedilink
      arrow-up
      9
      ·
      8 hours ago

      null will actually default back to the rules coming from CSS, I use this all over the place as a pattern