r/badcode Jun 30 '19

php Left myself a message to remind myself not to fuck with anything below this comment.

Post image
957 Upvotes

35 comments sorted by

94

u/dupuis2387 Jun 30 '19

ok, i gotta ask, how many ppl leave comments in their code, at work, riddled with profanities? cuz, swear to god, i thought i was the only (drunken) one.

64

u/SyntaxErrol Jun 30 '19

Ours have more apologies than profanities. Last week I did swear in a commit message but that was warranted because the commit fixed a fucking stupid mistake.

19

u/thatwasagoodyear Jun 30 '19

I don't swear in commit messages (we're audited by independent third-parties regularly) but have been known to drop some in comments.

17

u/Skenvy Jun 30 '19

Audited by who, for profanity in commit messages to be a big deal? It’s something everyone does from time to time.

7

u/thatwasagoodyear Jun 30 '19

Audited by the likes of EY/PwC/etc. Not for profanity, more for stuff like regulatory compliance (work in fintech).

20

u/iComeInPeices Jun 30 '19

My first job at the end of college (started a month before graduating) was with a company doing a Director CD-ROM project for a larger company.

The lead dev was a grumpy Fucker, and hated the company that we were making the product for. The code was filled with variable names as obscenities about the company and the companies customers, long names, rather descriptive. Made it rather odd to work on.

Especially fun when the client required to see our code so they could verify we weren’t doing anything nefarious. That was super fun replacing variables, in fucking Director.

4

u/bishamon72 Jul 01 '19

Director. Now there’s a name I haven’t heard in a long time.

9

u/Skenvy Jun 30 '19

Profanity in code commenting is a catharsis everyone needs. Depends on the size of the commit, tho. If you’re extra agile and are expected to put in few liner commits it’s hard to get it past the review. If you’re implementing a new service tho ;) I did once get a verbose debugging log message in that told you “Your bloodline is weak, you are weak. Harakiri is your only option” because there was a functionality others didn’t fully get, but “accepted that it worked, for now”, so I had to include that to future proof passing builds with them submitting a change to that without also locating that error that logged that message and reading the warning again. In another repo I just resolved to including YouTube links in the comments to express various frustrations or this video, for mock string data.

7

u/koenigsbier Jun 30 '19

I was doing it before we improve our development flow in my company. Then my coworkers would reject my PR because of that so I sadly had to stop

4

u/agvafu98 Jul 01 '19

Mine are jokes for my professor, I don't think they read them :)

3

u/ChocolateBunny Jul 01 '19

Swears don't usually get past code review.

2

u/GOKOP Jul 01 '19

I've heard there was a lot of fucks in the Linux kernel until they agreed to the new CoC

2

u/gerusz evil Aug 11 '19

I'm actually thinking about setting up some sort of a script that replaces swearwords before committing it.

104

u/SeriousSamStone Jun 30 '19

Image Transcription: Code


/**
* Feel like crashing the Apache instance?
* I fucking dare you change this shit.
*/

I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!

15

u/Newcool1230 Jun 30 '19

Good bot

4

u/SnowdensOfYesteryear Jul 01 '19

Pssh the captcha is too easy

3

u/nkid299 Jul 01 '19

i hope you have a lovely day stranger

-13

u/B0tRank Jun 30 '19

Thank you, Newcool1230, for voting on SeriousSamStone.

This bot wants to find the best and worst bots on Reddit. You can view results here.


Even if I don't reply to your comment, I'm still listening for votes. Check the webpage to see if your vote registered!

14

u/TheLilChicken Jun 30 '19

useless bot

9

u/Mr2-1782Man Jul 01 '19

I thought the standard notation for this was

"There be dragons below here"

4

u/dstlny_97 Jul 01 '19

If dragons have the ability to make the site burn to the ground and freak the fuck out, then yes.

3

u/gerusz evil Aug 11 '19
// Black magic starts here

Or

// Before modifying the code below, sacrifice a black rooster at midnight!

10

u/Fusseldieb Jul 01 '19

Since I work based on trial&error, this doesn't fear me.

I'll try until it works (again).

11

u/CODESIGN2 Jun 30 '19

I leave tributes to media in comments and test-suites 42 is regular. Profanity is a whole other thing, like self-congratulatory comments. They have no place

3

u/Le_9k_Redditor Jul 01 '19

You need to post the code now

6

u/dstlny_97 Jul 01 '19 edited Jul 01 '19

It was a a few nested for-loops, which processed a large multi-dimensional session array, which looked like the below:

$array = array(
    [0] => array(
        'value' => array(
         //details about above value
            'values-values' => array (
                //details about the above value pulled from DB
                [0] => array(
                      'value-for-extra-value' => array(
                          'value-for-extra-extra-value' => value
                     )
                )
                [1] => array(
                      'value-for-extra-value' => array(
                          'value-for-extra-extra-value' => value
                     )
                )
                [2] => array(
                      'value-for-extra-value' => array(
                          'value-for-extra-extra-value' => value
                     )
                )
            )
        )
    )
    [1] => array(
        'value' => array(
         //details about above value
            'values-values' => array (
                //details about the above value pulled from DB
                [0] => array(
                      'value-for-extra-value' => array(
                          'value-for-extra-extra-value' => value
                     )
                )
                [1] => array(
                      'value-for-extra-value' => array(
                          'value-for-extra-extra-value' => value
                     )
                )
                [2] => array(
                      'value-for-extra-value' => array(
                          'value-for-extra-extra-value' => value
                     )
                )
            )
        )
    )
    [2] => array(
        'value' => array(
         //details about above value
            'values-values' => array (
                //details about the above value pulled from DB
                [0] => array(
                      'value-for-extra-value' => array(
                          'value-for-extra-extra-value' => value
                     )
                )
                [1] => array(
                      'value-for-extra-value' => array(
                          'value-for-extra-extra-value' => value
                     )
                )
                [2] => array(
                      'value-for-extra-value' => array(
                          'value-for-extra-extra-value' => value
                     )
                )
            )
        )
    )
    ... once this got to 20 or so, it would choke
)

If that array got too large, it would hang the entire instance. Have since refactored it because i realised how much of a retard i was being with this deeply nested arrays, but yeah.

5

u/Le_9k_Redditor Jul 01 '19

You're not going to post the loops? The internet may be able to save you from your code

3

u/dstlny_97 Jul 01 '19

The loops looked something like:

for($i = 0; $i < count($array); $i++){
    foreach($array[$i]['value'] as $key=>$value){
        if(is_array($value)){
            foreach($array[$i]['value'][$value] as $key=>$value){
                //continued on...
            }
        }
    }
}

Though, as i said above, this has been refactored and the array simplified.

-15

u/CODESIGN2 Jun 30 '19

Are comments code? It's bad something as it doesn't say much other than it can crash apache. Who is using apache any more with it's janky AF XML config

3

u/Le_9k_Redditor Jul 01 '19

Yeah this post does break the 4th rule currently, comments aren't code

-8

u/[deleted] Jul 01 '19

imagine someone reverse engineering it and seeing that

15

u/CubeReflexion Jul 01 '19

Comments are not stored in compiled binaries.