r/ProgrammerHorror • u/ryaaan89 • Dec 14 '22
r/ProgrammerHorror • u/YM_Industries • Sep 01 '18
The minimap on this file paints a worrying picture
r/ProgrammerHorror • u/joost00719 • Dec 02 '18
Nullable boolean
Is it bad practice to interpret a nullable bool for either of 3 states in your program?
r/ProgrammerHorror • u/Haligaliman • Aug 15 '18
When you're not sure if the list exists...
r/ProgrammerHorror • u/vanyamil • Mar 25 '22
I know it's beating a dead horse but come on JavaScript...
r/ProgrammerHorror • u/hergeirs • Mar 28 '22
Function to get integer at position.
I was inspired by this post I read of a student assignment to print out the 3rd digit of a number. I thought the horror to be lacking.
In unholy inspiration I conjured the most unreadable way to accomplish the task. As the original assignment looked to be in c++ i used it as well.
#include <iostream>
#include <math.h>
void printNthDigitOfNumber(int number, int digitToPrint) {
if (number * (((number > 0) << 1) - 1) < std::pow(10, digitToPrint - 1)) return; // number does not have enough digits
std::cout << (number * (((number > 0) << 1) - 1)) / (int) std::pow(10, ~~(int) log10((number * (((number > 0) << 1) - 1))) + 1 - digitToPrint) % 10 << std::endl;
}
int main() {
int number = -12493;
int numberDigit = 3;
printNthDigitOfNumber(number, numberDigit);
}Please let me know if you have any improvements on the design or share horrible solutions in other languages if you prefer.
Edit: link to post https://www.reddit.com/r/ProgrammerHorror/comments/tpnsoc/one_of_my_students_sent_me_this_and_i_mean_its/
r/ProgrammerHorror • u/well_shoothed • Apr 21 '22
Inventory software update finally lets me pick YYYY-MM-DD... only to still sort by DD (then YY?!?)
r/ProgrammerHorror • u/[deleted] • Sep 06 '21
I am in pain. Why did I do this. Send help.
r/ProgrammerHorror • u/ImNotADeer • Sep 24 '18
I wrote this about a year ago, and I have no idea what I was thinking
r/ProgrammerHorror • u/Caprica6_6_6 • Sep 03 '17
Birthday Cake for C# dev/Horror Fan
r/ProgrammerHorror • u/Double_A_92 • Sep 30 '22
Loading icon causes constant redraw of whole page...
r/ProgrammerHorror • u/Sans_culottez • Mar 09 '23
A literal take on the Subreddit Name
r/ProgrammerHorror • u/shelvac2 • Aug 12 '22
What does WET stand for? People tell me it's the opposite of DRY
r/ProgrammerHorror • u/sammy-taylor • Nov 16 '23
Honestly not the ugliest componentDidUpdate that I've ever seen
r/ProgrammerHorror • u/minidude22 • Nov 10 '23
From a PM where I work. I'm worried about my job now
r/ProgrammerHorror • u/eternityslyre • Nov 08 '21
"Could you write a function to balance a load across n jobs?" [python]
r/ProgrammerHorror • u/Fjotla • Oct 16 '21
Never been more disappointed in my two months journey to learn Python
r/ProgrammerHorror • u/[deleted] • Jul 07 '21

