/r/programminghorror
Share strange or straight-up awful code.
RULES:
All posts MUST show terrible code. There are no exceptions.
No Editor Themes - If it's just your editor that looks bad, it doesn't belong here.
No Advertisement Code. This is generally written by people in marketing who only know what "code" looks like from other ads. It's not real code, so it doesn't belong.
No Student Code. Yes, they're learning, but bad code is part of the process.
No Generated Code. If it's minified JS, generated XML, or what have you, we don't want it here. Yes, the YouTube homepage has an extra right-angle bracket. We know.
No Asking for Help. Go to r/learnprogramming. What are you doing here?
No Spamming/Advertising. We don't care about your shitty Youtube video or new crypto that will "change the world".
Be Nice. No hate speech of any kind is allowed, as well as generally being a jerk. Talk about the code, not eachother.
No Direct Contact of the Mods. Please use the modmail, we don't want to be contacted directly.
Please direct stories without code to /r/talesfromtechsupport, and programming questions to /r/learnprogramming
Programming Horror is where developers come together to revel in the idiocy of our peers.
This subreddit is meant for sharing funny programming related stories and strange or straight-up awful code.
For the sake of not being mauled by rabid lawyer bears, please make sure to anonymize your stories - changing the names of people and companies.
For code examples, indent all your lines with 4 spaces to make it more readable:
foo = 'bar'
Sister subreddits
/r/programminghorror
Reposting from ProgrammingHumor because I'm an idiot and I didn't know this subreddit existed.
Long story short, Italy has this platform called PiracyShield which takes 2M€/year of taxpayer money to run. Allegedly, it's supposed to collect anonymous reports of piracy streaming, and take down the domains (?) within 30 minutes.
Recently, the code got leaked - there's a GitHub repo that contains the full deployment. This is the function that verifies the reports. I wish this was a joke, it is not.
Allow me three observations before I leave you to enjoy and discuss all the nuances of this absolute abomination.
The braindead logical naming. Since the service is prone to blocking, the negative phrasing check_unwanteds looks for whether the site being reported is legit (and hence the report would generate an unwanted takedown; return true) or it's actually piracy, and hence you don't want it to not be taken down; return false.
Obviously piracy might very well originate from any of those hosting providers, but I guess this was their best shot at verification. Just imagine what the brainstorming phase might have looked like.
When this crap went live for the first time, they erroneously blocked Google Drive for 24 hours in the whole country. It is reasonable to assume that adding the last element of the if statement "or 'google' in result" was the action taken in order to address the bug. You can find articles online.
On the bright side, my imposter's syndrome made a trip into /dev/null.
No, nothing outside of this snippet justifies anything wrong you see. Yes, this is production code.
Hello, am 27 and wanting to Start Programmin. I think i want to learn Java but i am Not Sure yet how to Start. Do you have any Tipps or reccomendations that could Help? 🥰
So I work with medical records and there is a scanning program we use. And today seemingly out of nowhere, it decided that the "H button" was banned. It wouldn't accept the input. All other buttons worked just fine. There's really only one type field in the entire program and it's to search a pt's name.
At first I thought it was the keyboard itself. So I immediately swapped it out. But nope, still nada. Then I pulled up notepad and "h" came right up no issue. Pulled up another worked just fine again.
I have no idea what the issue is. I've never heard of this before.
I ended up doing ye ol IT answer to everything and restarted the PC. And the issue went away.
But it's driving me nuts as to why it happened. I hope someone here might have an answer.
HELP!!! Was doing a Question on Strings and just couldn't get the logic ,Tried searching for the question on leetcode and GFG but couldn't find it can you guys help me solve it??
https://ng.tinyc.co/t20dsachallenge
Hello, I recently started programming and I'm looking for a notebook to program outside my room and I can't afford a very expensive notebook, I found a MacBook Pro mid 2009 with 8GB of RAM, Intel Core 2 Duo and a 240GB SSD, will it help me learn to program or is it too old to keep up with programming?
Is this even real computer science? it probably is, i recognize the value of making a map of your code through a flow chart, but who the hell designed these? its come to a point where i genuinely dont know if these are fully meant to be read like a toddler is trying to design a map or if i was just taught poorly
from top to bottom, Warnier's, Chapin's. Jackson's. Bertini's Tabourier's and \"Action\" Flowcharts
Hell, i cant even find any accounts for these methods aside from whatever my college is smoking. is this even a real thing or is my professor smoking a fat one and calling it a day? genuine help here on how i could possibly understand these flowcharts, specifically Tabouriers.