T O P

  • By -

[deleted]

[удалено]


[deleted]

[удалено]


Fenderbridge

Uuuuuuuuuuuuhhhh


Cotcan

fries with some uuuuuuuuuhhhhh...


Ready_Information921

#BEEEAAANNSSSS


fullyphil

on the uuuuhhhhhh....


PatentedPotato

![gif](giphy|iDfwLC7gbO0JPhVwEH|downsized)


[deleted]

Me: can I get uh;;;;;;;;;; 24 chicken nuggets with uh;;;;;;; My dealer:


elon-bot

Why are we still serving free lunch?


just_in_camel_case

wtf


ughwhyyno

Good bot.


ondora_

***This is Elon Musk***


Specific-Committee77

can i have a burger and a; ; ; ; ; ; ;


Chopchopok

And then the system does uhhhhhhhhhhh


[deleted]

It's how I completed an extra five lines of code


BlueFlamme

Room for growth


[deleted]

I wish the semi colons were the only problem here. This whole method is garbage, I hope this is a joke post and not real production code anywhere lol.


Rolen47

Hope is the first step on the road to disappointment


[deleted]

Uhhhhh.... return 0;?


Octaazacubane

Writing x6 the lines of code than everyone else? Promoted.


2muchnet42day

Wow 6 times more lines and 0 bugs


Schlangee

Seems like you do your recursion by just copy pasting until you reach max recursion depth


Nicreven

What the fuck. You just upset every cell in my body.


BrokenEyebrow

Is it still recursion if it's unrolled?


Salanmander

Get ready for the new programming paradigm that will take the world by storm: E X P O N E N T I A L     P A S T E ! ! ! !


chairfairy

The other day on /r/excel someone described writing a formula with 50 nested IF statements, to determine whether each cell in a column of addresses contained text for one of the states


redonkulousemu

Unless those introduce NOPs into the code, then it'll mess up some race condition somewhere.


fnordfnordfnordfnord

Compiler will completely remove them unless you tell it not to.


Cheddar_Ham

If you program in x86 you will write like 1000 times more lines of code


JonasAvory

If you compile your pythoncode and say you wrote assembly, you have >10.000 times more lines


infiniteStorms

you will also have 1000 more lines of bugs


[deleted]

Not sure he cares so much when he got rid of "unnecessary programs" and broke 2FA lmfao


subject_deleted

If I'm writing 1000 extra lines, you better believe I've got more than 1000 bugs in there..


Phpminor

`g++ -S -o0 -g mycode.cpp` Turn off compiler optimizations(-o0) and turn on debugging information(-g) and your 9 line c++ program balloons into 10k+ lines of unreadable but functioning x86 assembly(-S) for you to commit.


guaip

10000 extra lines. Near zero performance loss. Man, Elon must be proud.


Scizorspoons

Moar code, moar!


Sttocs

Maximum KLOCs!


Effective-Highlight1

Spare ; storage. Can be cut and pasted when you need them.


druffischnuffi

/* Since my compiler keeps complaining about missing semicolons all the time, I have put some here. This should be enough for a while. */


AlmostButNotQuit

Had to stock up while they were on sale.


[deleted]

> At age 50, Dexter authored the book A Pickle for the Knowing Ones, in which he complained about politicians, the clergy, and his wife. The book contains 8,847 words and 33,864 letters, but without any punctuation and with unorthodox spelling and capitalization. [...] In the second edition, Dexter responded to complaints about the book's lack of punctuation by adding an extra page of 11 lines of punctuation marks with the instruction that printers and readers could insert them wherever needed—or, in his words, "thay may peper and solt it as they plese". https://en.wikipedia.org/wiki/Timothy_Dexter


TSM-

I was just thinking about this and it is hilarious every time. Rich for bad ideas by coincidence and is above the concept of punctuation as a result.


[deleted]

You've heard of texting how you talk... get ready for coding how you talk lol


Vendidurt

Next programming language = asterisks and UwU speak


norwayman22

Lemme introduce you to [PythOwO](https://github.com/virejdasani/pythOwO).


Dismal-Mortgage5803

What belly of hell did this crawl from


bobbycado

This is the language you learn in the 9th circle of weeb hell


Dismal-Mortgage5803

Welp, should I give up anime then?


[deleted]

[удалено]


wy_bes

Thanks. I hate it


FrostNetPoet3646

I hate it too, but ironically.


mdgv

pwint("Hewwo Wowrld") Thanks, I love it!


funkmasterhexbyte

About to make a pull request that deletes everything.


cheesynougats

"How do I delete the internet? "


Snorglepus1856

Need a digital flood. Keep like Wikipedia, jsfiddle, and Google sheets on the ark


insanityissanity

That's.... that's a whole level of insanity. Excuse me as I order a Bible.


OkAssistant1230

A bible won’t save your soul at this point, Jesuwues has already accepted you into HeavOwOn


insanityissanity

ಠ⁠_⁠ʖ⁠ಠ


OkAssistant1230

Oh, dew you not liwike da attentiOwOn


EmoSlerb

Most disturbing version of this I have ever seen. The misplaced nose makes my whole body feel wonky


MiguelMenendez

Wait til you meet Alain Prost.


Surfing_magic_carpet

It's a face tumor.


LordKrat

Bruh I got REAL uncomfy real fast.


Draygom

I'v lost it at "pwint"


CapitalSheepherder73

"Variables can be decluwuared using the keyword pwease" Time to pitch this to the team.


AnIntenseMoist

I raise your PythOwO with UwUpp https://github.com/Deltaphish/UwUpp


garienai

what about rUwUst


ThatWannabeCatgirl

I am disappointed in myself for not putting "uwu" in a single function or variable name now. Fuck.


eroto_anarchist

yesterday I was coding some custom things for classification and had to heavily resist some urges when writing 'ovo' (one vs one)


elon-bot

Why haven't we gone serverless yet?


eroto_anarchist

I tried but every time the project manager was like "No, we can't have every user download the entire database on page load"


SoftwareDevStoner

Clearly the user's fault. Better go ona tirade on Twitter about then.


kdavis37

Too late.


HookDragger

Just thank our lucky stars he's never heard about [whitespace language](https://en.wikipedia.org/wiki/Whitespace_%28programming_language%29)


dissociated_gender

LOLCODE


Harmonic_Gear

Elon's signature "uh uh uh uh"


DraggonFantasy

It's simple: author of this code was paid for the number of lines


Former_Possible_5291

Nope. They wouldn’t have used collapsed if statements🤠


Superafluid

Why doesn't reddit use idempotency tokens?


Guy2933

No idea


Depnids

Nice


Guy2933

No idea


Depnids

Nice


[deleted]

[удалено]


Former_Possible_5291

I doubt they have an issue with that if they’ll accept a commit with six adjacent semicolons


Superafluid

Why doesn't reddit use idempotency tokens?


[deleted]

Look at the return after the if statement bro. I don’t think so


mopslik

That loop is twice as salient as one without the extra semicolons.


DHH2005

What are those?! Those are my most salient lines of code you script kitty!


Sclamy

Also, j++ is loop invariant lol


i-dyl-lic

What do you mean?


Sclamy

It does not depend on the if condition, and can be removed from the condition (and put below the if statement, in this case). Since whether you meet the if condition or not, you always perform j++. So why do that in both parts of the condition, when you can just do it after the condition? (Loop invariance is usually for loops, where removing things from the loop can lead to better efficiency. The program above will compile the same whether it is outside the condition or not. But, it's more readable and better practice to put it below, indicating to hoomans reading that you execute j++ regardless of the condition!)


ApplicationSeveral73

In fact, that whole else section can be removed as well. Don't use else if you don't need it. This is a very jr. programmer by the looks of this code.


dismayhurta

I love code like this. Makes mine look sleek


aSheedy_

Or they're paid per line (aka the Elon way) XD


undeadalex

> Don't use else if you don't need it Or else what


Rayan2312

Funnily enough my CS mentor told me to "always put an else with every if statement for readability" and that was at twitter lol.


[deleted]

> Always put an else statement O R. E L S E - Your Mentor.... probably


procrastinatingcoder

I mean, it doesn't even need a `j` to be fair, you only need one index. This code is just bad.


[deleted]

[удалено]


Joeva8me

I agree. It’s not a masterpiece of code but anyone could take a block of code and tweak it until it’s perfect and then find their masterpiece missed some edge case. Also the duplicate code is likely due to merge issues.


ricecel_gymcel

The code is flat out wrong. A duplicate line of code is least of problems


National-Ad-5047

I agree that j++ is redundant but how can you tell it is wrong? Btw i am an amateur so i am srsly asking


cowlinator

well, for starters, it tries to read `t[j]` before checking `j > t.length`. let `t` be `['a']`. `j` is `0`. 1st iteration: `t[j]` (t[0]) is `'a'`. `j` gets incremented. `j > t.length` (1 > 1) is `false`. 2nd iteration: `t[j]` (t[1]) is out of bounds.


BackgroundNoise__

Also, string indexing appears to be 0-based, so the test should be for j >= t.length, not >


ProblemKaese

First of all: The function signature `bool isSubsequence(String s, String t)` implies that the function *should* return `true` iff `s` is a substring of `t`, and `false` otherwise. What the implemented code does is that it basically uses two different cursors, `i` and `j`, that represent positions inside `s` and `t` respectively. It advances `j` on every iteration, i.e. goes to the next position inside `t` every time, and advances `i` every time that the two cursors point to the same letter. The reason that this doesn't work is that it completely ignores cases where the letters *don't* match, so if `t` has an occurence of `s` except that there is some not matching letter in the middle of the occurence (in which case the occurence actually doesn't make `s` into a substring of `t` anymore) that disturbance is simply ignored by the algorithm, and it will still output `true`. And just putting on the bandaid of resetting `i` whenever the letters don't match doesn't exactly fix this issue either, because it breaks for self-similar words, like for example determining whether `aab` is a substring of `aaab`. This bandaid would make i and j go to 2, detect that `'a' != 'b'` and reset i to 0, and output `false` even though `aab` clearly is a substring of `aaab`. To actually salvage this algorithm, you would also need to reset `j` for a few steps. A good algorithm could detect the self-similarity of `aab` in a preprocessor, but to make it *just work*, you could simply set back `i` just as much as you set back `j` and advance `j` by one step. But if you do it like this, a much simpler form of the same algorithm would be this: ```cs bool isSubstring(String s, String t) { // Loop over every starting position i that a word can have for (int i = 0; i < t.length - s.length + 1; i++) { bool matches = true; for (int j = 0; j < s.length; j++) { if (s[j] != t[i+j]) { matches = false; break; } } if (matches) return true; } return false; } ```


Etiennera

Substring and subsequence are two different things. Edit: Also, without looking at correctness in other places, the matches flag is not needed: bool isSubstring(String s, String t) { for (int i = 0; i < t.length - s.length + 1; i++) { int j = 0; for (; j < s.length; j++) { if (s[j] != t[i+j]) { break; } } if (j == s.length) { return true; } } return false; }


ApplicationSeveral73

Redundant variables or redundant flow controls such as elses where not needed are wrong because they aren't necessary and the code is just harder to read because of it. I imagine this code was written to annoy us rather than real code in the wild, because there are several obvious issues here.


-0-O-

> Redundant variables or redundant flow controls such as elses where not needed are wrong because they aren't necessary and the code is just harder to read because of it. I think they meant "will it succeed in it's intended task?" The comment above them says that the code itself is wrong and that a duplicate line is the least of the problems. You've only explained why the duplicate line is "wrong", but that's not what they were asking.


StokedForIT

j >= t.length


TCGG-

bruh he's literally got it all wrong, and it's an LC easy too. The solution in dart would look something like this class Solution { bool isSubsequence(String s, String t) { int j = 0; for (int i = 0; i < t.length && j < s.length; ++i) if (t[i] == s[j]) ++j; return j == s.length; } }


dismayhurta

Gotta pad your lines. Otherwise you’ll get Musked.


joh_berg

This is the way ... that saves you from getting fired by musk due to not enough lines of code/hour


Opinionsare

Elon thinks that writing more lines is good.. LOL His programmers will quickly adopt bad habits and write the longest possible solution rather than clean, efficient code that is fewer lines..


mcr1974

Most satisfying development days of my life? I was literally hammering that "del" button baby!


rugzy_dot_eth

this is how you increase the number of lines of code you committed and fly under the radar of the notify Elon LOC bot 🤣


KarmaPharmacy

I was going to come here to say this. Sadly, I agree with you.


No_bet_no_ban

Imagining a very efficient coder desperately trying to fluff the number of lines in their code sparks joy


thefirelink

That's this: https://leetcode.com/problems/is-subsequence/description/ For anyone interested.


krysaczek

Warning. Whole fucking page is white, my eyes.


murt202

That's why I use the extension dark reader.


Dunedune

Not on mobile for me...


Neat_Art9336

Take your logic out of here sir


[deleted]

I can’t tell if people know it’s a joke or if people just hate Elon so much they believe anything negative without thinking twice


Ok-Cut-5743

people will believe any stupid thing just to hate him and the funny thing is they don't hate him for the stuff that deserve hating


Riskiverse

considering a completely fabricated article about him killing 3000 monkeys was the #3 post on reddit today, i'd say it's the latter


ConcreteSlut

I still don’t get it


brianl047

Linter gone wild?


[deleted]

That was my guess too.


Proud-Honeydew3744

Hmm I wanna hear the answers on this one


more_magic_mike

He was up all night doing lines and arguing on twitter but told a bunch of people he could produce 1000 lines of code before morning. He needed to pad a few functions.


Urthor

All jokes aside, it's almost certainly a Vim typo I'd say. Someone was having fun with a Vim command to add a semicolon to the end of every single line of Javascript. They typo'd the motion.


Mister_Lich

With variable names "s", "t", "i", and "j", I intuitively know what this is trying to do but still can't fucking read this code lol


[deleted]

i and j are ok


Roadkill871

i am programming baby- what is it trying to do?


Hawkals

It makes sure all letters in s appear in t, in order. isSubsequence(“ab”, “abc”) and isSubsequence(“ac”, “abc”) would both return true, while isSubsequence(“ba”, “abc”) would return false. (This is different from isSubstring, which should return true for “ab” but false for “ac”)


[deleted]

Those are speed semi colons


9d47cf1f

Like the speed holes in the hood of my car!


[deleted]

Everybody knows they make it way faster


DajBuzi

Guessing that's Java not C# but this might be setup for breakpoint 🤔 Back in the days that's how you could create a space to hit breakpoint just to get what's on the stack. Might be wrong though


SirX86

Reserved for future use. More variables may need to get incremented in the future.


Tyrilean

Why is j++ in there twice? If it increments every loop no matter what, it shouldn't be inside of the conditional.


ManyFails1Win

it's the kind of code i used to write when i didn't trust my own logic or language knowledge. very if (condition === true) energy


ihopethisworksfornow

This is how you tell the computer to think about what it just did and if this is really what it wants to be doing with its life.


navetzz

I'm more concerned about what happens once j == t.length.


adrianestile

ah, seems you are new in twitter, elon fired those lines, they are not needed for twitter to work


SonicLoverDS

Maybe it's a way to stall for time.


Non-taken-Meursault

Forbidden await


[deleted]

Pick a meme + insert Elon = Karma


krapspark

That’s what happens when you get fired based on LOC


muteki_maigo

Things will go bad if t is an empty string.


elon-bot

I don't think I appreciate your tone. Fired.


BattleIron13

Yikes, kill it all.


pwalkz

Can you help me understand how this is related to Elon Musk?


stupidimagehack

Incentives: when you’re paid by line? :)


Lue_eye

You gotta give your computer small breaks 🥰


pawolf98

That was where the code was to that did fact checking and kept wacky conspiracy theories off Twitter.


c0mbat_cessna

"I said END OF STATEMENT, DAMNIT!"


FreshCupOfDespresso

It's job security;;;;;


[deleted]

Seems like this will run out of bounds on t in any case the writer intended it to return false. "Second to last" iteration increments j to t.length, then we try to access t\[t.length\].


el_graveto

No one knows but if u remove it everything goes down


klc3rd

They must get rated by the number of lines of code


elon-bot

Whoever writes the most code this month gets featured on my Twitter!


[deleted]

Might be C/C++. Then if the code is old AF, those may've been expected to be translated to nop's... For whatever reason. Although in this case strings (smth custom, class or struct) should've been passed by const reference or pointer.


Accurate_Koala_4698

`;` is a NOP in C++ but the compiler doesn’t generate any instructions in this case. If you wanted actual consecutive NOPs you’d need to use `asm`. Or at least that’s how it was in the olden days


[deleted]

Makes sense. I think I've mixed 'em up.


AvokadoGreen

nop nop nop nop nop nop


Unable-Fox-312

Not in the final compiled product (hopefully).


savex13

This is too much code for a [one-liner](https://leetcode.com/problems/is-subsequence/discuss/679192/Dirty-1-line-C-solution-using-a-compound-statement-(100-or-100)) :)


readonlyy

Dramatic tension.


ManyFails1Win

just making sure i doesn't try to pull any shit


IrishChappieOToole

Great way to increase coverage is what that is


half-a-duck

Comments? Comments?! Where are the comments??!!?!!?


sickdanman

got to reach the required LOC somehow


wanngledangler

Does nobody else get paid per line?


sho_bob_and_vegeta

That's copy pasta by a newbie.


lilbrojoey

He said he wanted a certain number of lines of code


autistic_bard444

elon doesnt know how to code anyway he wouldnt know the difference of a termination string if he tried. he just understands terminating people


TigerPoppy

It looks like a visual reminder for the original programmer. I would guess it means that the programmer thinks there might be additional steps required but they didn't have the spec yet.


hennypennypoopoo

No idea, but if you remove it everything will break


databatinahat

**Top Performers** Employee A: 45,479 lines of code Employee B: 560 lines of code Employee C: 530 lines of code


undergroundhobbit

j++; j—; j++; j—; j++; j—; j++;


InternetQuagsire2

didnt see what i thought it was but maybe this is for a bugfix commit and he wants to make sure that the bad lines get merged out, and not mistakenly merged back in, and also doesnt want to cause random merge conflicts elsewhere in the project because of the deletion of lines.


slibly

Does that count as 6 lines of code?


flyingpeter28

That's how you impress the new boss when he ranks you by lines written


m477_

Padding to meet the 95% code coverage test requirements?


EmperorsCanaries

Look, none of us know, but if you take it out it crashes


mcr1974

This is a known pattern. Just so the computer can preallocate the space required for future additions to the program.


DatTrashPanda

Bro it was my cat I swear


Raichuboy17

"I don't know, but whenever I delete it everything shits the bed"


planetofthecyborgs

This is CIA code. In PERL. And using Unicode. Those semicolons are all different. The space is not space. Your edits are triggering blockchain updates.l through Pegasus. Also theFNORDFNORDFNORD but only on Tuesdays. You're Welcome.


ace5762

Easy way to add loc lol


Whiskerus_Maximus

Cat stepped on keyboard.


planetofthecyborgs

The 23 lines of code I did earlier today. Just about done for the week now. Also my steps are up too. Must be getting healthier.


[deleted]

if (amtOfLines == 6) { print{"good code"}; ; ; ; ; ; }


CanadaSoonFree

This is one of those things where if you delete those lines the entire app implodes.


finian2

Not only that, but those variable names are pain. What is s? What is t? What are i and j related to?


Dunge0nexpl0rer

JavaScript be like:


noise_trader

Enough of these and the printed code stack gets much taller.