subreddit stringclasses 7
values | author stringlengths 3 20 | id stringlengths 5 7 | content stringlengths 67 30.4k | score int64 0 140k |
|---|---|---|---|---|
programminghorror | Indigowar | ggt11q5 | <|sols|><|sot|>When you see it<|eot|><|sol|>https://i.redd.it/ihb7rdosby661.png<|eol|><|sor|>What of this more strange? JavaScript in video about Unity and UE4 or `if("true" === "true) return false` ?<|eor|><|eols|><|endoftext|> | 405 |
programminghorror | inxaneninja | ggt5rf2 | <|sols|><|sot|>When you see it<|eot|><|sol|>https://i.redd.it/ihb7rdosby661.png<|eol|><|sor|>What of this more strange? JavaScript in video about Unity and UE4 or `if("true" === "true) return false` ?<|eor|><|sor|>I think this is just filler background stuff and it isn't related to the video.<|eor|><|eols|><|endoftext|... | 108 |
programminghorror | Katana__ | ggtik4x | <|sols|><|sot|>When you see it<|eot|><|sol|>https://i.redd.it/ihb7rdosby661.png<|eol|><|sor|>What of this more strange? JavaScript in video about Unity and UE4 or `if("true" === "true) return false` ?<|eor|><|sor|>The latter is usually symptomatic of a preprocessor; if you build the HTML server-side, you'd end up injec... | 60 |
programminghorror | Amardella | ggtwmcu | <|sols|><|sot|>When you see it<|eot|><|sol|>https://i.redd.it/ihb7rdosby661.png<|eol|><|sor|>Ah. My trifocals and I couldn't quite read the blurry text.<|eor|><|eols|><|endoftext|> | 27 |
programminghorror | omega_haunter | ggtwco8 | <|sols|><|sot|>When you see it<|eot|><|sol|>https://i.redd.it/ihb7rdosby661.png<|eol|><|sor|>What of this more strange? JavaScript in video about Unity and UE4 or `if("true" === "true) return false` ?<|eor|><|sor|>Unity supports JS, so it is not that weird.
Edit: apperently it doesn't anymore.<|eor|><|sor|>It did a lo... | 25 |
programminghorror | lurker10001000 | gguj40j | <|sols|><|sot|>When you see it<|eot|><|sol|>https://i.redd.it/ihb7rdosby661.png<|eol|><|sor|>What of this more strange? JavaScript in video about Unity and UE4 or `if("true" === "true) return false` ?<|eor|><|sor|>The latter is usually symptomatic of a preprocessor; if you build the HTML server-side, you'd end up injec... | 24 |
programminghorror | Amardella | ggu0s6c | <|sols|><|sot|>When you see it<|eot|><|sol|>https://i.redd.it/ihb7rdosby661.png<|eol|><|sor|>True is true<|eor|><|sor|>But "false" is always truthy.<|eor|><|eols|><|endoftext|> | 22 |
programminghorror | Bluecrafter35 | gguw442 | <|sols|><|sot|>When you see it<|eot|><|sol|>https://i.redd.it/ihb7rdosby661.png<|eol|><|sor|>Wouldn't it be faster to say this?
if("a" === "a")<|eor|><|sor|>Or if(true)<|eor|><|sor|>Or just return false<|eor|><|eols|><|endoftext|> | 22 |
programminghorror | Naitsab_33 | ggtvksb | <|sols|><|sot|>When you see it<|eot|><|sol|>https://i.redd.it/ihb7rdosby661.png<|eol|><|sor|>It's also according to how you're using JS. I remember writing a guessing game in school that wanted the player to pick a number from 1 to 100 and would alert "higher" or "lower" until the answer was correct, then do a celebra... | 21 |
programminghorror | sixft7in | gguhzb9 | <|sols|><|sot|>When you see it<|eot|><|sol|>https://i.redd.it/ihb7rdosby661.png<|eol|><|sor|>Wouldn't it be faster to say this?
if("a" === "a")<|eor|><|eols|><|endoftext|> | 20 |
programminghorror | jediwizard7 | ggv9ecg | <|sols|><|sot|>When you see it<|eot|><|sol|>https://i.redd.it/ihb7rdosby661.png<|eol|><|sor|>What of this more strange? JavaScript in video about Unity and UE4 or `if("true" === "true) return false` ?<|eor|><|sor|>I think this is just filler background stuff and it isn't related to the video.<|eor|><|sor|>Yeah it kind ... | 18 |
programminghorror | lear85 | ggu9w2g | <|sols|><|sot|>When you see it<|eot|><|sol|>https://i.redd.it/ihb7rdosby661.png<|eol|><|sor|>True is true<|eor|><|sor|>But "false" is always truthy.<|eor|><|sor|>[deleted]<|eor|><|sor|>The WORD false is falsy. The STRING "false" is truthy. As in an array like wordsStartWithF containing "fair", "few", "false" or a str... | 18 |
programminghorror | tentwelfths | ggv0e3f | <|sols|><|sot|>When you see it<|eot|><|sol|>https://i.redd.it/ihb7rdosby661.png<|eol|><|sor|>Booleans are just a social construct...<|eor|><|sor|>Blasphemy!
Bools are the One True Data Type, all other data types are convenient interpretations we have constructed.
BuT whAt ABoUT iNteGerS? thE nUMbeR thIRtEen isNt bOo... | 15 |
programminghorror | Jmcgee1125 | ggtz1k9 | <|sols|><|sot|>When you see it<|eot|><|sol|>https://i.redd.it/ihb7rdosby661.png<|eol|><|sor|>What of this more strange? JavaScript in video about Unity and UE4 or `if("true" === "true) return false` ?<|eor|><|sor|>Unity supports JS, so it is not that weird.
Edit: apperently it doesn't anymore.<|eor|><|sor|>It did a lo... | 15 |
programminghorror | matbiz01 | ggtx5ol | <|sols|><|sot|>When you see it<|eot|><|sol|>https://i.redd.it/ihb7rdosby661.png<|eol|><|sor|>Ah. My trifocals and I couldn't quite read the blurry text.<|eor|><|soopr|>"What of this more strange? JavaScript in video about Unity and UE4 or `if("true" === "true) return false` ?" - copied from the most upvoted comment<|eo... | 14 |
programminghorror | KonkenBonken | ggunlo1 | <|sols|><|sot|>When you see it<|eot|><|sol|>https://i.redd.it/ihb7rdosby661.png<|eol|><|sor|>Wouldn't it be faster to say this?
if("a" === "a")<|eor|><|sor|>Or if(true)<|eor|><|eols|><|endoftext|> | 14 |
programminghorror | Valmond | ggu8nfd | <|sols|><|sot|>When you see it<|eot|><|sol|>https://i.redd.it/ihb7rdosby661.png<|eol|><|sor|>Ah. My trifocals and I couldn't quite read the blurry text.<|eor|><|soopr|>"What of this more strange? JavaScript in video about Unity and UE4 or `if("true" === "true) return false` ?" - copied from the most upvoted comment<|eo... | 14 |
programminghorror | Katana__ | ggujcdl | <|sols|><|sot|>When you see it<|eot|><|sol|>https://i.redd.it/ihb7rdosby661.png<|eol|><|sor|>What of this more strange? JavaScript in video about Unity and UE4 or `if("true" === "true) return false` ?<|eor|><|sor|>The latter is usually symptomatic of a preprocessor; if you build the HTML server-side, you'd end up injec... | 13 |
programminghorror | Amardella | ggu2xsz | <|sols|><|sot|>When you see it<|eot|><|sol|>https://i.redd.it/ihb7rdosby661.png<|eol|><|sor|>True is true<|eor|><|sor|>But "false" is always truthy.<|eor|><|sor|>[deleted]<|eor|><|sor|>The WORD false is falsy. The STRING "false" is truthy. As in an array like wordsStartWithF containing "fair", "few", "false" or a str... | 13 |
programminghorror | SCBbestof | ctfel1 | <|sols|><|sot|>Email validation by an intern<|eot|><|sol|>https://i.redd.it/c3z6bcx1dsh31.png<|eol|><|eols|><|endoftext|> | 1,131 |
programminghorror | FuzzyYellowBallz | exkj3n9 | <|sols|><|sot|>Email validation by an intern<|eot|><|sol|>https://i.redd.it/c3z6bcx1dsh31.png<|eol|><|sor|>Ah, he hasn't learned to just copy-paste the first result from stack overflow like a *real* developer<|eor|><|eols|><|endoftext|> | 530 |
programminghorror | posherspantspants | exkoxax | <|sols|><|sot|>Email validation by an intern<|eot|><|sol|>https://i.redd.it/c3z6bcx1dsh31.png<|eol|><|sor|>Ah, he hasn't learned to just copy-paste the first result from stack overflow like a *real* developer<|eor|><|soopr|>I added a comment in which I suggested the use of regex. The response was "I thought of it, but ... | 291 |
programminghorror | SCBbestof | exkk74u | <|sols|><|sot|>Email validation by an intern<|eot|><|sol|>https://i.redd.it/c3z6bcx1dsh31.png<|eol|><|sor|>Ah, he hasn't learned to just copy-paste the first result from stack overflow like a *real* developer<|eor|><|soopr|>I added a comment in which I suggested the use of regex. The response was "I thought of it, but ... | 248 |
programminghorror | Kelpsie | exkkrdx | <|sols|><|sot|>Email validation by an intern<|eot|><|sol|>https://i.redd.it/c3z6bcx1dsh31.png<|eol|><|sor|>Say it with me now, kids: don't roll your own email validation.
It's like the baby brother of rolling your own crypto.<|eor|><|eols|><|endoftext|> | 176 |
programminghorror | posherspantspants | exkp0x1 | <|sols|><|sot|>Email validation by an intern<|eot|><|sol|>https://i.redd.it/c3z6bcx1dsh31.png<|eol|><|sor|>Say it with me now, kids: don't roll your own email validation.
It's like the baby brother of rolling your own crypto.<|eor|><|sor|>`npm install --save email-validator`
$ Installed 2,391 packages<|eor|><|eols|><... | 159 |
programminghorror | CallumCarmicheal | exktwbb | <|sols|><|sot|>Email validation by an intern<|eot|><|sol|>https://i.redd.it/c3z6bcx1dsh31.png<|eol|><|sor|>Ah, he hasn't learned to just copy-paste the first result from stack overflow like a *real* developer<|eor|><|soopr|>I added a comment in which I suggested the use of regex. The response was "I thought of it, but ... | 143 |
programminghorror | NoodleSnoo | exko32k | <|sols|><|sot|>Email validation by an intern<|eot|><|sol|>https://i.redd.it/c3z6bcx1dsh31.png<|eol|><|sor|>[Relevant XKCD](https://xkcd.com/208/)<|eor|><|eols|><|endoftext|> | 110 |
programminghorror | WHY_DO_I_SHOUT | exkpecz | <|sols|><|sot|>Email validation by an intern<|eot|><|sol|>https://i.redd.it/c3z6bcx1dsh31.png<|eol|><|sor|>Ah, he hasn't learned to just copy-paste the first result from stack overflow like a *real* developer<|eor|><|soopr|>I added a comment in which I suggested the use of regex. The response was "I thought of it, but ... | 99 |
programminghorror | KeepingItSFW | exkqfjf | <|sols|><|sot|>Email validation by an intern<|eot|><|sol|>https://i.redd.it/c3z6bcx1dsh31.png<|eol|><|sor|>Ah, he hasn't learned to just copy-paste the first result from stack overflow like a *real* developer<|eor|><|soopr|>I added a comment in which I suggested the use of regex. The response was "I thought of it, but ... | 88 |
programminghorror | haibusa2005 | exkexrp | <|sols|><|sot|>Email validation by an intern<|eot|><|sol|>https://i.redd.it/c3z6bcx1dsh31.png<|eol|><|sor|>I can't believe my dumbass doesn't understand this<|eor|><|sor|>Function returns "@" as invalid char. In an email address.<|eor|><|eols|><|endoftext|> | 70 |
programminghorror | CallumCarmicheal | exku7fb | <|sols|><|sot|>Email validation by an intern<|eot|><|sol|>https://i.redd.it/c3z6bcx1dsh31.png<|eol|><|sor|>Say it with me now, kids: don't roll your own email validation.
It's like the baby brother of rolling your own crypto.<|eor|><|sor|>`npm install --save email-validator`
$ Installed 2,391 packages<|eor|><|sor|>Ca... | 69 |
programminghorror | SCBbestof | exkfa66 | <|sols|><|sot|>Email validation by an intern<|eot|><|sol|>https://i.redd.it/c3z6bcx1dsh31.png<|eol|><|sor|>I can't believe my dumbass doesn't understand this<|eor|><|sor|>Function returns "@" as invalid char. In an email address.<|eor|><|soopr|>Mention: this method is called twice. Split the email by @ --> check first ... | 69 |
programminghorror | kageurufu | exkq907 | <|sols|><|sot|>Email validation by an intern<|eot|><|sol|>https://i.redd.it/c3z6bcx1dsh31.png<|eol|><|sor|>Ah, he hasn't learned to just copy-paste the first result from stack overflow like a *real* developer<|eor|><|soopr|>I added a comment in which I suggested the use of regex. The response was "I thought of it, but ... | 66 |
programminghorror | divideByNulls | exkxnkb | <|sols|><|sot|>Email validation by an intern<|eot|><|sol|>https://i.redd.it/c3z6bcx1dsh31.png<|eol|><|sor|>Ah, he hasn't learned to just copy-paste the first result from stack overflow like a *real* developer<|eor|><|soopr|>I added a comment in which I suggested the use of regex. The response was "I thought of it, but ... | 44 |
programminghorror | Marzhall | exlanvd | <|sols|><|sot|>Email validation by an intern<|eot|><|sol|>https://i.redd.it/c3z6bcx1dsh31.png<|eol|><|sor|>email validation is hard. sometimes email addres get rejected for having a + symbol<|eor|><|sor|>That's the worst. I love doing the `myEmailAddy+<siteImRegisteringOn>@gmail.com` thing, and the only thing that's wo... | 39 |
programminghorror | svick | exkvr31 | <|sols|><|sot|>Email validation by an intern<|eot|><|sol|>https://i.redd.it/c3z6bcx1dsh31.png<|eol|><|sor|>Say it with me now, kids: don't roll your own email validation.
It's like the baby brother of rolling your own crypto.<|eor|><|sor|>`npm install --save email-validator`
$ Installed 2,391 packages<|eor|><|sor|>[T... | 38 |
programminghorror | CarolusRexEtMartyr | exkzn48 | <|sols|><|sot|>Email validation by an intern<|eot|><|sol|>https://i.redd.it/c3z6bcx1dsh31.png<|eol|><|sor|>Say it with me now, kids: don't roll your own email validation.
It's like the baby brother of rolling your own crypto.<|eor|><|sor|>`npm install --save email-validator`
$ Installed 2,391 packages<|eor|><|sor|>[T... | 36 |
programminghorror | chiru9670 | tsv8yc | <|sols|><|sot|>Poetry<|eot|><|sol|>https://i.redd.it/kc620bcgkoq81.jpg<|eol|><|eols|><|endoftext|> | 1,126 |
programminghorror | Khethall | i2tqaaa | <|sols|><|sot|>Poetry<|eot|><|sol|>https://i.redd.it/kc620bcgkoq81.jpg<|eol|><|sor|>There's an actual programming language that works like that.
https://codewithrockstar.com/<|eor|><|eols|><|endoftext|> | 172 |
programminghorror | snf | i2ug6oi | <|sols|><|sot|>Poetry<|eot|><|sol|>https://i.redd.it/kc620bcgkoq81.jpg<|eol|><|sor|> #define suffer =(
Well that seems appropriate<|eor|><|eols|><|endoftext|> | 135 |
programminghorror | ThatDudeBesideYou | i2tq2m6 | <|sols|><|sot|>Poetry<|eot|><|sol|>https://i.redd.it/kc620bcgkoq81.jpg<|eol|><|sor|>This is actually one of the macro substitutions that's pretty good, usually they're all the same<|eor|><|eols|><|endoftext|> | 107 |
programminghorror | Minteck | i2tsgvm | <|sols|><|sot|>Poetry<|eot|><|sol|>https://i.redd.it/kc620bcgkoq81.jpg<|eol|><|sor|>I love that feature from C<|eor|><|eols|><|endoftext|> | 32 |
programminghorror | wubsytheman | i2tr7wh | <|sols|><|sot|>Poetry<|eot|><|sol|>https://i.redd.it/kc620bcgkoq81.jpg<|eol|><|sor|>Is that the Shakespeare esoteric language?<|eor|><|eols|><|endoftext|> | 32 |
programminghorror | BakuhatsuK | i2vnbyd | <|sols|><|sot|>Poetry<|eot|><|sol|>https://i.redd.it/kc620bcgkoq81.jpg<|eol|><|sor|> #define suffer =(
Well that seems appropriate<|eor|><|sor|>Also
#define end return 0;<|eor|><|eols|><|endoftext|> | 28 |
programminghorror | qwertysrj | i2v9snh | <|sols|><|sot|>Poetry<|eot|><|sol|>https://i.redd.it/kc620bcgkoq81.jpg<|eol|><|sor|>There's an actual programming language that works like that.
https://codewithrockstar.com/<|eor|><|sor|>Shakespeare is closer I guess<|eor|><|eols|><|endoftext|> | 21 |
programminghorror | bnl1 | i2ufbag | <|sols|><|sot|>Poetry<|eot|><|sol|>https://i.redd.it/kc620bcgkoq81.jpg<|eol|><|sor|>TIL that or is a C++ keyword.<|eor|><|sor|>Yep, so is and. There are few more, like xor, not, compl. Also not_eq, or_eq, xor_eq, and_eq are !=, |=, \^=, &= respectivly. Then there are also bit variants (bitor (|) and bitand (&)). For so... | 21 |
programminghorror | YellowBunnyReddit | i2tukxw | <|sols|><|sot|>Poetry<|eot|><|sol|>https://i.redd.it/kc620bcgkoq81.jpg<|eol|><|sor|>TIL that or is a C++ keyword.<|eor|><|eols|><|endoftext|> | 20 |
programminghorror | gkreitz | i2ugd22 | <|sols|><|sot|>Poetry<|eot|><|sol|>https://i.redd.it/kc620bcgkoq81.jpg<|eol|><|sor|>Reminds me of the Shakespeare Programming Language, http://shakespearelang.sourceforge.net/<|eor|><|eols|><|endoftext|> | 16 |
programminghorror | Jonno_FTW | i2u5zem | <|sols|><|sot|>Poetry<|eot|><|sol|>https://i.redd.it/kc620bcgkoq81.jpg<|eol|><|sor|>Is that the Shakespeare esoteric language?<|eor|><|sor|>It's c
Edit - c++<|eor|><|sor|>It's C++<|eor|><|eols|><|endoftext|> | 15 |
programminghorror | KiwiManThe19th | i2u169c | <|sols|><|sot|>Poetry<|eot|><|sol|>https://i.redd.it/kc620bcgkoq81.jpg<|eol|><|sor|>Is that the Shakespeare esoteric language?<|eor|><|sor|>It's c
Edit - c++<|eor|><|eols|><|endoftext|> | 12 |
programminghorror | KiwiManThe19th | i2u6dk4 | <|sols|><|sot|>Poetry<|eot|><|sol|>https://i.redd.it/kc620bcgkoq81.jpg<|eol|><|sor|>Is that the Shakespeare esoteric language?<|eor|><|sor|>It's c
Edit - c++<|eor|><|sor|>It's C++<|eor|><|sor|>Ur right - didn't see the std:cout<|eor|><|eols|><|endoftext|> | 8 |
programminghorror | VinceGhii | i2wk4lc | <|sols|><|sot|>Poetry<|eot|><|sol|>https://i.redd.it/kc620bcgkoq81.jpg<|eol|><|sor|>There's an actual programming language that works like that.
https://codewithrockstar.com/<|eor|><|sor|>There is also a pretty awesome talk how and why that programming-language was created.
It's called "The Art of Code" - https://www... | 7 |
programminghorror | Bob-The-One | i2uh4xt | <|sols|><|sot|>Poetry<|eot|><|sol|>https://i.redd.it/kc620bcgkoq81.jpg<|eol|><|sor|>What is that syntax highlighting? Why is every capitalized word purple?<|eor|><|sor|>Probably types are PascalCase, so they're highlighted differently. Could be the other way around too.<|eor|><|eols|><|endoftext|> | 7 |
programminghorror | YellowBunnyReddit | i2upbdf | <|sols|><|sot|>Poetry<|eot|><|sol|>https://i.redd.it/kc620bcgkoq81.jpg<|eol|><|sor|>TIL that or is a C++ keyword.<|eor|><|sor|>Yep, so is and. There are few more, like xor, not, compl. Also not_eq, or_eq, xor_eq, and_eq are !=, |=, \^=, &= respectivly. Then there are also bit variants (bitor (|) and bitand (&)). For so... | 7 |
programminghorror | faubi | i2uzv1d | <|sols|><|sot|>Poetry<|eot|><|sol|>https://i.redd.it/kc620bcgkoq81.jpg<|eol|><|sor|>TIL that or is a C++ keyword.<|eor|><|sor|>Was it evident from the code?<|eor|><|sor|>"or" is used in the code but theres not a #define for it, which implies it already has a definition in C++<|eor|><|eols|><|endoftext|> | 7 |
programminghorror | Rc202402 | i2wbvt1 | <|sols|><|sot|>Poetry<|eot|><|sol|>https://i.redd.it/kc620bcgkoq81.jpg<|eol|><|sor|>There's an actual programming language that works like that.
https://codewithrockstar.com/<|eor|><|sor|>Shakespeare is closer I guess<|eor|><|sor|>It is<|eor|><|eols|><|endoftext|> | 5 |
programminghorror | blueshiftlabs | i2vl3z2 | <|sols|><|sot|>Poetry<|eot|><|sol|>https://i.redd.it/kc620bcgkoq81.jpg<|eol|><|sor|>TIL that or is a C++ keyword.<|eor|><|sor|>Was it evident from the code?<|eor|><|sor|>"or" is used in the code but theres not a #define for it, which implies it already has a definition in C++<|eor|><|sor|>You're right, it's in the code... | 5 |
programminghorror | _xithyl | bkdolz | <|sols|><|sot|>A game of 2048 in one line ... which I made for python3<|eot|><|sol|>https://i.redd.it/nd1n41rwc2w21.png<|eol|><|eols|><|endoftext|> | 1,122 |
programminghorror | wicket-maps | emg2xar | <|sols|><|sot|>A game of 2048 in one line ... which I made for python3<|eot|><|sol|>https://i.redd.it/nd1n41rwc2w21.png<|eol|><|sor|>It's very impressive yet utterly despicable, thank you for sharing.<|eor|><|eols|><|endoftext|> | 186 |
programminghorror | _xithyl | emg07nn | <|sols|><|sot|>A game of 2048 in one line ... which I made for python3<|eot|><|sol|>https://i.redd.it/nd1n41rwc2w21.png<|eol|><|sor|>Can you explain it?<|eor|><|soopr|>First we create a two-dimensional 4x4 array as the field. Then we try to find all indices with zeros and replace one random one of them with a 2 or 4.
T... | 132 |
programminghorror | OdBx | emfyuuq | <|sols|><|sot|>A game of 2048 in one line ... which I made for python3<|eot|><|sol|>https://i.redd.it/nd1n41rwc2w21.png<|eol|><|sor|>Can you explain it?<|eor|><|eols|><|endoftext|> | 84 |
programminghorror | MalicousMonkey | emfzi37 | <|sols|><|sot|>A game of 2048 in one line ... which I made for python3<|eot|><|sol|>https://i.redd.it/nd1n41rwc2w21.png<|eol|><|sor|>Can you explain it?<|eor|><|sor|>Not even he knows how it works now<|eor|><|eols|><|endoftext|> | 76 |
programminghorror | _xithyl | emg2qmk | <|sols|><|sot|>A game of 2048 in one line ... which I made for python3<|eot|><|sol|>https://i.redd.it/nd1n41rwc2w21.png<|eol|><|sor|>Can you post a link to this? It's one line... But I really don't want to type it out to try it.. No offence..<|eor|><|soopr|> (lambda np,rand:(lambda d,ml,r,ff: (lambda l:lambda k:l(l,... | 67 |
programminghorror | DrexanRailex | emgf1oz | <|sols|><|sot|>A game of 2048 in one line ... which I made for python3<|eot|><|sol|>https://i.redd.it/nd1n41rwc2w21.png<|eol|><|sor|>Cool. Now do it in 0 lines. ( <|eor|><|sor|>Here:
Its input is via imagination. Its output too. It may have some bugs.<|eor|><|eols|><|endoftext|> | 38 |
programminghorror | IlanRegal | emgxn79 | <|sols|><|sot|>A game of 2048 in one line ... which I made for python3<|eot|><|sol|>https://i.redd.it/nd1n41rwc2w21.png<|eol|><|sor|>Can you explain it?<|eor|><|soopr|>First we create a two-dimensional 4x4 array as the field. Then we try to find all indices with zeros and replace one random one of them with a 2 or 4.
T... | 35 |
programminghorror | MrArchLinux | emg1hzk | <|sols|><|sot|>A game of 2048 in one line ... which I made for python3<|eot|><|sol|>https://i.redd.it/nd1n41rwc2w21.png<|eol|><|sor|>Can you post a link to this? It's one line... But I really don't want to type it out to try it.. No offence..<|eor|><|eols|><|endoftext|> | 27 |
programminghorror | _xithyl | emg79u0 | <|sols|><|sot|>A game of 2048 in one line ... which I made for python3<|eot|><|sol|>https://i.redd.it/nd1n41rwc2w21.png<|eol|><|sor|>I don't think using numpy counts as one line of python<|eor|><|soopr|>Well most numpy functions used (rot90 and ndenumerare) are easy to replicate. But you are right i shouldn't have used... | 26 |
programminghorror | Plasticcaz | emgj4rt | <|sols|><|sot|>A game of 2048 in one line ... which I made for python3<|eot|><|sol|>https://i.redd.it/nd1n41rwc2w21.png<|eol|><|sor|>Can you explain it?<|eor|><|sor|>"When I first wrote this only God and I knew how it worked. Now, only God knows."<|eor|><|eols|><|endoftext|> | 23 |
programminghorror | Rue9X | emg4j8u | <|sols|><|sot|>A game of 2048 in one line ... which I made for python3<|eot|><|sol|>https://i.redd.it/nd1n41rwc2w21.png<|eol|><|sor|>I hate lambda. It's cool you can do this OP, but I hate devs who use lambda to "save space" and make shit completely unreadable.<|eor|><|eols|><|endoftext|> | 14 |
programminghorror | mjsaah | emg6eni | <|sols|><|sot|>A game of 2048 in one line ... which I made for python3<|eot|><|sol|>https://i.redd.it/nd1n41rwc2w21.png<|eol|><|sor|>I don't think using numpy counts as one line of python<|eor|><|eols|><|endoftext|> | 14 |
programminghorror | _xithyl | emhrzpx | <|sols|><|sot|>A game of 2048 in one line ... which I made for python3<|eot|><|sol|>https://i.redd.it/nd1n41rwc2w21.png<|eol|><|sor|>Can you explain it?<|eor|><|soopr|>First we create a two-dimensional 4x4 array as the field. Then we try to find all indices with zeros and replace one random one of them with a 2 or 4.
T... | 14 |
programminghorror | BioOrpheus | emg4dab | <|sols|><|sot|>A game of 2048 in one line ... which I made for python3<|eot|><|sol|>https://i.redd.it/nd1n41rwc2w21.png<|eol|><|sor|>#OH LAWD, HE COMING<|eor|><|eols|><|endoftext|> | 13 |
programminghorror | CodenameLambda | emh5kj9 | <|sols|><|sot|>A game of 2048 in one line ... which I made for python3<|eot|><|sol|>https://i.redd.it/nd1n41rwc2w21.png<|eol|><|sor|>A commented and pretty-printed version of the source code above:
# numpy.ndenumerate(arr) yields an iterator of tuples with the coordinates of the current value first, and the value ... | 11 |
programminghorror | crikeydilehunter | emga602 | <|sols|><|sot|>A game of 2048 in one line ... which I made for python3<|eot|><|sol|>https://i.redd.it/nd1n41rwc2w21.png<|eol|><|sor|>I hate lambda. It's cool you can do this OP, but I hate devs who use lambda to "save space" and make shit completely unreadable.<|eor|><|sor|>Lambdas have valid uses though. But I wouldn'... | 11 |
programminghorror | yawpitch | emgup4q | <|sols|><|sot|>A game of 2048 in one line ... which I made for python3<|eot|><|sol|>https://i.redd.it/nd1n41rwc2w21.png<|eol|><|sor|>how do you even begin to code this?<|eor|><|sor|>First you write the program correctly and then you refactor until its all calls to regular named functions that all have an exactly one li... | 10 |
programminghorror | alexhmc | y0421n | <|sols|><|sot|>I just did a type cast to swap 1s and 0s. Oh god.<|eot|><|sol|>https://i.redd.it/rcdkq7wnbws91.png<|eol|><|eols|><|endoftext|> | 1,116 |
programminghorror | alexhmc | irpwzuk | <|sols|><|sot|>I just did a type cast to swap 1s and 0s. Oh god.<|eot|><|sol|>https://i.redd.it/rcdkq7wnbws91.png<|eol|><|soopr|>Small explanation:
`+` casts to a number (used as the unary positive number operator),
`!` casts to a boolean and inverts it.
- `+ (e)` is casting e to a number ("1" => 1)
- `! (+e)` is cas... | 286 |
programminghorror | Waffl3_Ch0pp3r | irpxesl | <|sols|><|sot|>I just did a type cast to swap 1s and 0s. Oh god.<|eot|><|sol|>https://i.redd.it/rcdkq7wnbws91.png<|eol|><|soopr|>Small explanation:
`+` casts to a number (used as the unary positive number operator),
`!` casts to a boolean and inverts it.
- `+ (e)` is casting e to a number ("1" => 1)
- `! (+e)` is cas... | 113 |
programminghorror | alexhmc | irpyowq | <|sols|><|sot|>I just did a type cast to swap 1s and 0s. Oh god.<|eot|><|sol|>https://i.redd.it/rcdkq7wnbws91.png<|eol|><|sor|>Yeah 4AM is not a time of optimal creative energy. I learn that lesson once every couple of months.
Also JS has bitwise negation. Ive never used it but this seems like a solid use case.<|eor|... | 90 |
programminghorror | ics-fear | irqclfy | <|sols|><|sot|>I just did a type cast to swap 1s and 0s. Oh god.<|eot|><|sol|>https://i.redd.it/rcdkq7wnbws91.png<|eol|><|sor|>Could also have used `.map(e => 1 - e)`<|eor|><|eols|><|endoftext|> | 77 |
programminghorror | epsleq0 | irq0evt | <|sols|><|sot|>I just did a type cast to swap 1s and 0s. Oh god.<|eot|><|sol|>https://i.redd.it/rcdkq7wnbws91.png<|eol|><|sor|>Yeah 4AM is not a time of optimal creative energy. I learn that lesson once every couple of months.
Also JS has bitwise negation. Ive never used it but this seems like a solid use case.<|eor|... | 77 |
programminghorror | alexhmc | irq7uv2 | <|sols|><|sot|>I just did a type cast to swap 1s and 0s. Oh god.<|eot|><|sol|>https://i.redd.it/rcdkq7wnbws91.png<|eol|><|sor|>My question is why the binary represented as an array of strings -- is this some huge ass number? Wouldn't the fastest way to use bitwise operations on bits?<|eor|><|soopr|>The primary focus w... | 52 |
programminghorror | alexhmc | irq1eh3 | <|sols|><|sot|>I just did a type cast to swap 1s and 0s. Oh god.<|eot|><|sol|>https://i.redd.it/rcdkq7wnbws91.png<|eol|><|sor|>Yeah 4AM is not a time of optimal creative energy. I learn that lesson once every couple of months.
Also JS has bitwise negation. Ive never used it but this seems like a solid use case.<|eor|... | 45 |
programminghorror | hennell | irqhf1j | <|sols|><|sot|>I just did a type cast to swap 1s and 0s. Oh god.<|eot|><|sol|>https://i.redd.it/rcdkq7wnbws91.png<|eol|><|soopr|>Small explanation:
`+` casts to a number (used as the unary positive number operator),
`!` casts to a boolean and inverts it.
- `+ (e)` is casting e to a number ("1" => 1)
- `! (+e)` is cas... | 35 |
programminghorror | h00chieminh | irq7epl | <|sols|><|sot|>I just did a type cast to swap 1s and 0s. Oh god.<|eot|><|sol|>https://i.redd.it/rcdkq7wnbws91.png<|eol|><|sor|>My question is why the binary represented as an array of strings -- is this some huge ass number? Wouldn't the fastest way to use bitwise operations on bits?<|eor|><|eols|><|endoftext|> | 34 |
programminghorror | h00chieminh | irq7zpy | <|sols|><|sot|>I just did a type cast to swap 1s and 0s. Oh god.<|eot|><|sol|>https://i.redd.it/rcdkq7wnbws91.png<|eol|><|sor|>My question is why the binary represented as an array of strings -- is this some huge ass number? Wouldn't the fastest way to use bitwise operations on bits?<|eor|><|soopr|>The primary focus w... | 29 |
programminghorror | No-Witness2349 | irq0dhw | <|sols|><|sot|>I just did a type cast to swap 1s and 0s. Oh god.<|eot|><|sol|>https://i.redd.it/rcdkq7wnbws91.png<|eol|><|sor|>I wrote some whacky alternatives because honestly I dont know how this ought to be done. Ive omitted the `e.substr(2)` bits
e => e.split("0").map(ones => ones.replace(/1/g, "0")).join("1")... | 27 |
programminghorror | eloel- | irq2mof | <|sols|><|sot|>I just did a type cast to swap 1s and 0s. Oh god.<|eot|><|sol|>https://i.redd.it/rcdkq7wnbws91.png<|eol|><|sor|>I wrote some whacky alternatives because honestly I dont know how this ought to be done. Ive omitted the `e.substr(2)` bits
e => e.split("0").map(ones => ones.replace(/1/g, "0")).join("1")... | 22 |
programminghorror | h00chieminh | irq7rxz | <|sols|><|sot|>I just did a type cast to swap 1s and 0s. Oh god.<|eot|><|sol|>https://i.redd.it/rcdkq7wnbws91.png<|eol|><|sor|>My question is why the binary represented as an array of strings -- is this some huge ass number? Wouldn't the fastest way to use bitwise operations on bits?<|eor|><|soopr|>The primary focus w... | 21 |
programminghorror | BurningRome | irqlj1w | <|sols|><|sot|>I just did a type cast to swap 1s and 0s. Oh god.<|eot|><|sol|>https://i.redd.it/rcdkq7wnbws91.png<|eol|><|soopr|>Small explanation:
`+` casts to a number (used as the unary positive number operator),
`!` casts to a boolean and inverts it.
- `+ (e)` is casting e to a number ("1" => 1)
- `! (+e)` is cas... | 20 |
programminghorror | LetterBoxSnatch | irrarrk | <|sols|><|sot|>I just did a type cast to swap 1s and 0s. Oh god.<|eot|><|sol|>https://i.redd.it/rcdkq7wnbws91.png<|eol|><|soopr|>Small explanation:
`+` casts to a number (used as the unary positive number operator),
`!` casts to a boolean and inverts it.
- `+ (e)` is casting e to a number ("1" => 1)
- `! (+e)` is cas... | 20 |
programminghorror | ings0c | irqorkq | <|sols|><|sot|>I just did a type cast to swap 1s and 0s. Oh god.<|eot|><|sol|>https://i.redd.it/rcdkq7wnbws91.png<|eol|><|soopr|>Small explanation:
`+` casts to a number (used as the unary positive number operator),
`!` casts to a boolean and inverts it.
- `+ (e)` is casting e to a number ("1" => 1)
- `! (+e)` is cas... | 17 |
programminghorror | Waffl3_Ch0pp3r | irqg449 | <|sols|><|sot|>I just did a type cast to swap 1s and 0s. Oh god.<|eot|><|sol|>https://i.redd.it/rcdkq7wnbws91.png<|eol|><|soopr|>Small explanation:
`+` casts to a number (used as the unary positive number operator),
`!` casts to a boolean and inverts it.
- `+ (e)` is casting e to a number ("1" => 1)
- `! (+e)` is cas... | 17 |
programminghorror | R3D3-1 | irqdvme | <|sols|><|sot|>I just did a type cast to swap 1s and 0s. Oh god.<|eot|><|sol|>https://i.redd.it/rcdkq7wnbws91.png<|eol|><|sor|> bin.replace("0", "2").replace("1", "0").replace("2", "1")
would probably be my first guess how to do it in Python, assuming only valid inputs to that code part. Not sure ad hoc if there wo... | 14 |
programminghorror | HarZe_ESP | efupjn | <|sols|><|sot|>Found in production, I have no words<|eot|><|sol|>https://i.redd.it/38flmts4xy641.png<|eol|><|eols|><|endoftext|> | 1,121 |
programminghorror | stepan213 | fc2isvf | <|sols|><|sot|>Found in production, I have no words<|eot|><|sol|>https://i.redd.it/38flmts4xy641.png<|eol|><|sor|>Thats the kind of code you write after 173 coffees, 837 redbulls and 23 toothpaste tubes.<|eor|><|eols|><|endoftext|> | 381 |
programminghorror | Farsqueaker | fc2jqol | <|sols|><|sot|>Found in production, I have no words<|eot|><|sol|>https://i.redd.it/38flmts4xy641.png<|eol|><|sor|>I appreciate that THIRTY\_SECS is zero indexed.<|eor|><|eols|><|endoftext|> | 250 |
programminghorror | Tsunami1LV | fc2iwwx | <|sols|><|sot|>Found in production, I have no words<|eot|><|sol|>https://i.redd.it/38flmts4xy641.png<|eol|><|sor|>Thats the kind of code you write after 173 coffees, 837 redbulls and 23 toothpaste tubes.<|eor|><|sor|>So every morning then?<|eor|><|eols|><|endoftext|> | 132 |
programminghorror | AStrangeStranger | fc2l72w | <|sols|><|sot|>Found in production, I have no words<|eot|><|sol|>https://i.redd.it/38flmts4xy641.png<|eol|><|sor|>Clearly 14 minutes wasn't enough.<|eor|><|sor|>Actually, it was 14 times too much. But since we're lying to management about why the code is too slow we don't need to worry about accuracy.<|eor|><|sor|>The... | 112 |
programminghorror | HarZe_ESP | fc2iwgb | <|sols|><|sot|>Found in production, I have no words<|eot|><|sol|>https://i.redd.it/38flmts4xy641.png<|eol|><|sor|>Thats the kind of code you write after 173 coffees, 837 redbulls and 23 toothpaste tubes.<|eor|><|soopr|>After getting SonarLint to almost crash in the sight of this project, I can only agree<|eoopr|><|eols... | 91 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.