this post was submitted on 07 Jul 2024
548 points (96.8% liked)

Programmer Humor

19187 readers
1203 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 1 year ago
MODERATORS
 

I am not allowed to credit the site that has this disaster. Its owner said "Nobody should see that"

top 50 comments
sorted by: hot top controversial new old
[–] bleistift2@sopuli.xyz 116 points 2 months ago (2 children)

The author should be killed for indentation alone.

[–] mosiacmango@lemm.ee 23 points 2 months ago* (last edited 2 months ago)

I know, right? Needs more tab.

[–] afox@lemmy.world 5 points 2 months ago

We are witnessing a hate crime.

[–] TechieDamien@lemmy.ml 101 points 2 months ago (1 children)

Client: "Can you switch these two colours, you have 1 minute to fix it or you're fired!"

Result:

load more comments (1 replies)
[–] hendrik@palaver.p3x.de 76 points 2 months ago (1 children)
color: lime !important;
z-index: 1000000;

[–] xmunk@sh.itjust.works 53 points 2 months ago (2 children)

I love the superstitious z-index just in case it does something to help.

[–] independantiste@sh.itjust.works 23 points 2 months ago (1 children)

At least that's actually easy and quick to do and is the only way of doing it. Centering a div however has 81639393 ways and it seems the one that works is different every time

[–] CodexArcanum@lemmy.world 47 points 2 months ago (13 children)

Bro its so easy bro, just use flexboxgridcolumns its been a standard since 2010 just flex it bro you haven't learned to flex yet just check w3c schools and add a flex you can polyfill it but don't use that hacked one use the good flexpolyfill then { content-align-middle-child-elements: center-middle-true-neutral } so easy with flex bro

[–] CatLikeLemming@lemmy.blahaj.zone 18 points 2 months ago (1 children)

I know you meant this sarcastically, but yes, flex is a good option for centering something. Either that or setting the left and right margins of the element to auto, which is generally even easier.

Basically, if you're in a flex container use flex, if you're in a grid use grid, and if neither of those apply set the left and right margins to auto.

[–] marcos@lemmy.world 6 points 2 months ago (3 children)

Also seriously, anybody having problems with flexbox should try this:

https://flexboxfroggy.com/

I'm not sure there's any version of it for grids, but IMO grids are inherently more intuitive, so it may not be needed. Flexbox is the one that is hard to learn.

[–] davidgro@lemmy.world 3 points 2 months ago

I don't know any CSS (despite reading memes about it like this) but I do know that the bottom of that page has a link to something called Grid Garden

load more comments (2 replies)
[–] Cosmonaut_Collin@lemmy.world 10 points 2 months ago

Dude, stop flexing on him. You're gonna make him cry.

[–] independantiste@sh.itjust.works 10 points 2 months ago

You've perfectly captured twitter tech bro energy it's kind of incredible actually

load more comments (10 replies)
load more comments (1 replies)
[–] 9point6@lemmy.world 32 points 2 months ago (1 children)

Not allowed to credit the site in your text editor?

Is the owner in the room with you now?

[–] GregorTacTac@lemm.ee 14 points 2 months ago (2 children)

This screenshot is not mine, it was sent to me via Matrix

[–] Natanael@slrpnk.net 19 points 2 months ago (1 children)

You get used to it. I don't even see the code

[–] GregorTacTac@lemm.ee 10 points 2 months ago (1 children)

Do you have a built-in browser in your brain that renders it?

[–] dohpaz42@lemmy.world 14 points 2 months ago (1 children)

All I see is blonde, brunette, redhead. Hey uh, you want a drink?

[–] GregorTacTac@lemm.ee 5 points 2 months ago (1 children)
[–] dohpaz42@lemmy.world 8 points 2 months ago (1 children)

It's good for two things: De-greasing engines and killing brain cells.

[–] GregorTacTac@lemm.ee 5 points 2 months ago (1 children)
[–] GregorTacTac@lemm.ee 7 points 2 months ago (1 children)

It's only now that I realise that I understood that reference so late

[–] roguetrick@lemmy.world 4 points 2 months ago

Took ya a bit Keanu, but you got there.

load more comments (1 replies)
[–] marcos@lemmy.world 28 points 2 months ago (1 children)

Well, that's what you get for using classes like "white" and "lime".

[–] dajoho@sh.itjust.works 9 points 2 months ago

Exactly this. Bootstrap killed the css star.

[–] bjoern_tantau@swg-empire.de 24 points 2 months ago

People learning CSS through shitty frameworks:

[–] independantiste@sh.itjust.works 22 points 2 months ago

At first I only noticed the indent. Wtf

[–] drathvedro@lemm.ee 19 points 2 months ago (6 children)

I'm appalled that classes representing visual styles are still a thing. I thought everyone already figured that it was a bad idea back in bootstrap days. But then I recently had an opportunity to work on project that uses Vuetify and saw quite long poems about flexboxes in class names...

[–] ClassifiedPancake@discuss.tchncs.de 7 points 2 months ago (2 children)
load more comments (2 replies)
[–] calcopiritus@lemmy.world 6 points 2 months ago (1 children)

Aren't classes in CSS supposed to represent visual styles? What else could they be for?

[–] Mesa@programming.dev 21 points 2 months ago (1 children)

Pretty sure they're referring to class names describing the visual style being applied, rather than what that class represents semantically.

E.g. .red-bold vs. .error-text

[–] calcopiritus@lemmy.world 7 points 2 months ago

Oh, that makes sense.

[–] Ephera@lemmy.ml 4 points 2 months ago (1 children)

Well, there's not exactly a ~~class~~ training you have to take before writing CSS, so everyone starting out with it gets to make all those same mistakes for themselves before they know how to use classes sensibly. I myself am some backend guy, who has to write CSS far too often.

It certainly also does not help that various CSS frameworks out there do exactly that...

[–] bleistift2@sopuli.xyz 3 points 2 months ago (2 children)

It certainly also does not help that various CSS frameworks out there do exactly that…

Bootstrap (as of v5) being one of them. div class="d-flex gap-2 my-3 align-items-center flex-nowrap justify-content-between

I was annoyed at this at first, but I’ve since noticed that I write hardly any CSS any more, because most rules really are “just add some space, vertically align, be red”.

[–] Ephera@lemmy.ml 6 points 2 months ago* (last edited 2 months ago)

Yeah, the reason why people deride it, is because it's practically equivalent to:

div style="flex: 1; gap: 2em; margin-top: 3em; margin-bottom: 3em; ..."

I had to look up what these do, so they might not be precisely correct translations, but hopefully, you get the idea. It's mostly like using inline styles, and like not using classes.

In some scenarios, these frameworks might simplify certain things, like how my applies two CSS rules. And they reduce the visual clutter of inline styling somewhat.

But overall, it feels like people are dissatisfied with semantic classes, but don't want to lead the discussion for using inline styles, so they grab these CSS frameworks to pretend that they're not using inline styles.

It is fundamentally a difficult discussion to lead, because inline styles feel great, while you're writing them. They're less great for maintenance.
But semantic classes definitely have long-term problems, too.

[–] Blackmist@feddit.uk 5 points 2 months ago

Could argue here that you're still writing CSS, just cross compiling to it from Bootstrap shortcuts.

load more comments (3 replies)
[–] aeronmelon@lemmy.world 16 points 2 months ago

"Some coders just want to watch the word ~~burn~~ get colored white and/or lime."

And if you delete one or the other, or condense the code into a single command, the whole site breaks.

[–] MonkderVierte@lemmy.ml 10 points 2 months ago* (last edited 2 months ago) (2 children)
[–] Peter_Arbeitsloser@feddit.org 34 points 2 months ago (1 children)

Isn't cascading styles the whole point of Cascading Style Sheets?

[–] _stranger_@lemmy.world 26 points 2 months ago* (last edited 2 months ago)

You absolute fool. You must never utter its full name, lest you summon its wrath!

[–] wizzor@sopuli.xyz 14 points 2 months ago (3 children)

I don't get it, isn't this a pretty normal way of using media queries. Granted you're more likely to see the widths defined in px.

[–] ByteOnBikes@slrpnk.net 10 points 2 months ago (1 children)

Shhh... The poster doesn't understand CSS and we shouldn't embarrass them in a community with memes

[–] wizzor@sopuli.xyz 4 points 2 months ago

My imposter syndrome kicked in full swing. I was ready to learn a CSS best practice and feel uncomfortable about it for the rest off the day.

load more comments (2 replies)
[–] dajoho@sh.itjust.works 8 points 2 months ago (7 children)

I am very, very surprised about the competence of the commenters here. I have had many discussions on reddit about the advantages of meaningful instead of presentational class-naming and you're normally met with great resistance, especially with users of frameworks like Bootstrap and Tailwind.

Here, everyone seems to either 'get it' or is willing to hear why classes like .lime are bad. Very cool.

[–] criss_cross@lemmy.world 7 points 2 months ago (1 children)

People that advocate for presentation naming haven't endured a major company rebrand.

load more comments (1 replies)
load more comments (6 replies)
[–] RedStrider@lemmy.world 7 points 2 months ago (2 children)
load more comments (2 replies)
[–] bloubz@lemmygrad.ml 6 points 2 months ago (2 children)

I guess the class matches the color of the background (applied on a parent element), and the text is the opposite color?

[–] Ephera@lemmy.ml 7 points 2 months ago (1 children)

My guess would be that they initially named the classes like the colors and then decided to swap those two colors.

load more comments (1 replies)
[–] communism@lemmy.ml 6 points 2 months ago

Lime text with a white background or vice versa sounds horrifying and illegible

[–] Holzkohlen@feddit.de 3 points 2 months ago (1 children)

I hate all webdev beyond using raw HTML, CSS and Javascript to make your own crappy website

load more comments (1 replies)
load more comments
view more: next ›