this post was submitted on 22 Jul 2024
4 points (100.0% liked)

Programming Horror

2043 readers
1 users here now

Welcome to Programming Horror!

This is a place to share strange or terrible code you come across.

For more general memes about programming there's also Programmer Humor.

Looking for mods. If youre interested in moderating the community feel free to dm @[email protected]

Rules

Credits

founded 2 years ago
MODERATORS
 
top 12 comments
sorted by: hot top controversial new old
[–] [email protected] 3 points 8 months ago

Now please publish it as a Node.js module and in 3 weeks, it will be in Top 10 most used modules, being used in 90% of Fortune 500 corporations.

[–] [email protected] 1 points 8 months ago (1 children)

But… does it pass all the tests?

[–] [email protected] 2 points 8 months ago (1 children)

If it does, they don't have enough of the right tests.

[–] [email protected] 0 points 8 months ago (1 children)
[–] [email protected] 2 points 8 months ago* (last edited 8 months ago) (2 children)

What would the output be for the following:

99 Beers on the Wall!

[–] [email protected] 2 points 8 months ago

Or for "CAFÉ"?

[–] [email protected] 1 points 2 months ago* (last edited 2 months ago)

I think it would be

11 beers on the wall.

[–] [email protected] 1 points 6 months ago* (last edited 6 months ago)

Honestly as long as literals are properly converted, I don't see any other way to do this in an entirely encoding agnostic way

[–] [email protected] 1 points 8 months ago* (last edited 8 months ago) (1 children)

This will not work on Unicode

Greek and Arabic have cases as well

[–] [email protected] 1 points 8 months ago (1 children)

This will not work on Unicode

Correct.

Greek and Arabic have cases as well

Who told you that?

[–] [email protected] 2 points 8 months ago

Brain fart, I meant Cyrillic but I wrote the wrong word! Good catch thanks!

[–] [email protected] 1 points 8 months ago

I hope this is O(n!)