this post was submitted on 21 Jan 2026
379 points (99.2% liked)

Programmer Humor

28764 readers
622 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] joyjoy@lemmy.zip 41 points 4 days ago (3 children)

Why are you using Node.removeChild for? Are you trying to support a 13 year old browser? Switch to Element.remove

[–] bestelbus22@lemmy.world 71 points 4 days ago (2 children)

Lack of knowledge I guess. Which is why I like posting code on the internet. Thanks for the tip!

[–] allywilson@lemmy.ml 16 points 4 days ago

OMG, this is the internet don't be posting self-flaws. Jeez. ^kthxlvubai^

[–] callyral@pawb.social 9 points 4 days ago (4 children)

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

[–] joyjoy@lemmy.zip 9 points 4 days ago

Scripts aren't just for complex tasks. They're also for consistency. 

[–] timsjel@piefed.world 2 points 3 days ago

Here is my most recent script, not gonna lie, pretty proud of this bad boy. /s

shjava per/med/xwpp01 A001 conv.txt

echo 'yo'

shjava per/med/xwpp01 A002 conv.txt

echo 'yo'

shjava per/med/xwpp01 A003 conv.txt

echo 'yo'

shjava per/med/xwpp01 A004 conv.txt

echo 'yo'

shjava per/med/xwpp01 A005 conv.txt

echo 'yo'

shjava per/med/xwpp01 A006 conv.txt

echo 'yo'

shjava per/med/xwpp01 A007 conv.txt

echo 'yo'

shjava per/med/xwpp01 A008 conv.txt

echo 'yo'

[–] bestelbus22@lemmy.world 1 points 3 days ago

Love this kind of stuff. I have a whole reposity of fish functions that do stuff because I'm too lazy :)

Only thing I can recommend (as well as for literally any script) is using set -u. Only because it's awful to debug unset variables and there's never a use case for using unset variables.

[–] bleistift2@sopuli.xyz 12 points 4 days ago* (last edited 4 days ago)

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

[–] MonkderVierte@lemmy.zip 4 points 4 days ago* (last edited 4 days ago)

"Make it a webapp, so it runs everywhere" my ass.