• (disco)
    _ = require('comment');
    
  • (disco)

    -1 not enough jquery

  • (disco)

    What is that Unicode symbol above the ProGet ad?

  • (disco) in reply to aliceif

    U+F729 PRIVATE USE CODEPOINT

    This is a Private Use codepoint. That is, it is deliberately not assigned to any character. It was added to Unicode in version 1.1 and belongs to the block Private Use Area.

    The glyph is not a composition. It has a Ambiguous East Asian Width. In bidirectional context it acts as Left To Right and is not mirrored. In text U+F729 behaves as Unknown regarding line breaks. It has type Other for sentence and Other for word breaks. The Grapheme Cluster Break is Any.

  • (disco)

    Superior code formatting shows a bug in line 39 which repeats the condition of line 38

    if (_) {
    if (__) {
    if (___) {
    if (____) {
    if (_____) {
    if (______) {
    if (_______) {
    if (________) {
    if (_________) {
    if (__________) {
    if (___________) {
    if (____________) {
    if (_____________) {
    if (______________) {
    if (_______________) {
    if (________________) {
    if (_________________) {
    if (__________________) {
    if (___________________) {
    if (____________________) {
    if (_____________________) {
    if (______________________) {
    if (_______________________) {
    if (________________________) {
    if (_________________________) {
    if (__________________________) {
    if (___________________________) {
    if (____________________________) {
    if (_____________________________) {
    if (______________________________) {
    if (_______________________________) {
    if (________________________________) {
    if (_________________________________) {
    if (__________________________________) {
    if (___________________________________) {
    if (____________________________________) {
    if (_____________________________________) {
    if (______________________________________) {
    if (______________________________________) {
    if (_______________________________________) {
    } else { ________________________________________ = require('lodash'); }
    } else { _______________________________________ = require('lodash'); }
    } else { ______________________________________ = require('lodash'); }
    } else { _____________________________________ = reqeire('lodash'); }
    } else { ____________________________________ = require('lodash'); }
    } else { ___________________________________ = require('lodash'); }
    } else { __________________________________ = require('lodash'); }
    } else { _________________________________ = require('lodash'); }
    } else { ________________________________ = require('lodash'); }
    } else { _______________________________ = require('lodash'); }
    } else { ______________________________ = require('lodash'); }
    } else { _____________________________ = require('lodash'); }
    } else { ____________________________ = require('lodash'); }
    } else { ___________________________ = require('lodash'); }
    } else { __________________________ = require('lodash'); }
    } else { _________________________ = require('lodash'); }
    } else { ________________________ = require('lodash'); }
    } else { _______________________ = require('lodash'); }
    } else { ______________________ = require('lodash'); }
    } else { _____________________ = require('lodash'); }
    } else { ____________________ = require('lodash'); }
    } else { ___________________ = require('lodash'); }
    } else { __________________ = require('lodash'); }
    } else { _________________ = require('lodash'); }
    } else { ________________ = require('lodash'); }
    } else { _______________ = require('lodash'); }
    } else { ______________ = require('lodash'); }
    } else { _____________ = require('lodash'); }
    } else { ____________ = require('lodash'); }
    } else { ___________ = require('lodash'); }
    } else { __________ = require('lodash'); }
    } else { _________ = require('lodash'); }
    } else { ________ = require('lodash'); }
    } else { _______ = require('lodash'); }
    } else { ______ = require('lodash'); }
    } else { _____ = require('lodash'); }
    } else { ____ = require('lodash'); }
    } else { ___ = require('lodash'); }
    } else { __ = require('lodash'); }
    } else { _ = require('lodash'); }
    
  • (disco)

    ...and the call to reqeire()

  • (disco)

    _____________________________________ = reqeire('lodash');

    :grimacing:

    :hanzo:

  • (disco)

    I think I want to require that this pattern not occur in my codebase.

  • (disco)

    How do you call stuff on it then? Do you have to do another 40 levels of if every time?

  • (disco)

    Clearly a loop is in order here:

    var var_underscore = "";
    for(var i = 1; i <= 40; i++){
        var_underscore += "_";
        if(eval(var_underscore)){
            eval(var_underscore + "= require('lodash')");
            break;
        }
    }
    

    Filed Under: #obviousSolution


    sehetw:
    Superior code formatting shows a bug in line 39 which repeats the condition of line 38

    You fool. That bug is only there to protect the submitter. If anybody from his workplace ever mentions this article, he can simply say "Nah, our codebase is way better. Look at line 39".

    Filed Under: Foolproof, really!

  • (disco) in reply to Julia
    Julia:
    ...and the call to reqeire()
    This is a proof that the author at least doesn't copy-paste code everywhere.
  • (disco)

    Now I know why ultra-wide monitors are getting more popular...

  • (disco) in reply to terkans

    It's practically a reqeirement for code like that.

  • (disco)

    Reply 1: This was done for a bet. Right?

    Reply 2: I would like to see the original code for this! I find difficult to credit, even with a Grand Master of WTFy, that this number of consecutive "ifs" could be typed without causing near fatal RSI.

    Reply 3: Unless I am seriously mistaken: This can be refactored to _ = require('lodash') because if it fails the first test, it will be loaded and assigned to itself any way. Yes. I know. The inverse of this (reply) is that there is a "one in a million" chance that 'lodash' won't be needed, and "...as everybody knows, one in a million chances happen all the time..."

    Unless........

    In an extremely [insert additional / better adjectives here] unlikely series of events you need to use 'reqeire' (nod to @Julia, @boomzilla) or the slightly less rare occasion when you would have to get a second opinion (nod to @sehetw)

  • (disco) in reply to loose
    loose:
    Unless I am seriously mistaken: This can MUSTbe refactored to _ = require('lodash')

    FTFTSOS

  • (disco)

    Can someone explain why anyone, no matter how feeble-minded, would do this?

  • (disco) in reply to mozzis

    It is their last day at work

  • (disco) in reply to accalia

    Ahhh, The passive response. By saying "it can", you don't get too disappointed when it doesn't happen. Subtle I know, but think about it. Also, it baits tempts allows encourages those more OCDish gungho idle capable to do it for you. :grin:

  • (disco)

    Clearly this should be corrected to:

    do {
        _ = require('lodash');
    } while (!_);
    

    This is much easier to maintain since it's shorter, and won't suffer from the obvious 39th failure, 40th success bug that a for loop would.

    This code is guaranteed to succeed!

  • (disco)

    I was going to manufacture fabulous post, butttttttttt unique lengths wordzzzzzz difficult.

    (Darn namespaces.)

  • (disco) in reply to BaconBits
    BaconBits:
    This code is guaranteed to succeed!

    or die get stuck in a terrible infinite loop trying?

  • (disco)

    TRWTF is all that nesting. Independent IF statements FTW! :trollface:

    if () { } else { __ = require('lodash'); } if () { } else { ___ = require('lodash'); } if () { } else { ____ = require('lodash'); } if () { } else { _____ = require('lodash'); } if () { } else { ______ = require('lodash'); } if (__) { } else { ______ = require('lodash'); } if (____) { } else { _______ = require('lodash'); } if () { } else { ________ = require('lodash'); } if () { } else { _________ = require('lodash'); } if () { } else { __________ = require('lodash'); } if () { } else { ___________ = require('lodash'); } if () { } else { ____________ = require('lodash'); } if () { } else { _____________ = require('lodash'); } if () { } else { ______________ = require('lodash'); } if (______) { } else { _______________ = require('lodash'); } if (__________) { } else { ________________ = require('lodash'); } if () { } else { _________________ = require('lodash'); } if () { } else { __________________ = require('lodash'); } if (_______________) { } else { ________________________ = require('lodash'); } if () { } else { ___________________ = require('lodash'); } if () { } else { ____________________ = require('lodash'); } if () { } else { _____________________ = require('lodash'); } if () { } else { ______________________ = require('lodash'); } if () { } else { _______________________ = require('lodash'); } if () { } else { _________________________ = require('lodash'); } if () { } else { __________________________ = require('lodash'); } if () { } else { ___________________________ = require('lodash'); } if () { } else { ____________________________ = require('lodash'); } if () { } else { _____________________________ = require('lodash'); } if (___________________________) { } else { ______________________________ = require('lodash'); } if (__) { } else { _______________________________ = require('lodash'); } if () { } else { ________________________________ = require('lodash'); } if () { } else { _________________________________ = require('lodash'); } if () { } else { __________________________________ = require('lodash'); } if () { } else { ___________________________________ = require('lodash'); } if (__) { } else { ____________________________________ = require('lodash'); } if () { } else { _____________________________________ = require('lodash'); } if () { } else { ______________________________________ = require('lodash'); } if () { } else { _______________________________________ = require('lodash'); } if (__________________________________) { } else { ________________________________________ = require('lodash'); }

    Bonus: easier to troubleshoot.

  • (disco) in reply to redwizard
    redwizard:
    Bonus: easier to troubleshoot.

    seriously, i can think of no defensible reason for that monstrosity to exist.

    Even IF there really is some batshit insane reason for lodash to be loaded into that many variables the code at worst should be:

    _ = \
    __ = \
    ___ = \
    ____ = \
    _____ = \
    ______ = \
    _______ = \
    ________ = \
    _________ = \
    __________ = \
    ___________ = \
    ____________ = \
    _____________ = \
    ______________ = \
    _______________ = \
    ________________ = \
    _________________ = \
    __________________ = \
    ___________________ = \
    ____________________ = \
    _____________________ = \
    ______________________ = \
    _______________________ = \
    ________________________ = \
    _________________________ = \
    __________________________ = \
    ___________________________ = \
    ____________________________ = \
    _____________________________ = \
    ______________________________ = \
    _______________________________ = \
    ________________________________ = \
    _________________________________ = \
    __________________________________ = \
    ___________________________________ = \
    ____________________________________ = \
    _____________________________________ = \
    ______________________________________ = \
    _______________________________________ = \
    ________________________________________ = require('lodash');
    
    Modules are cached after the first time they are loaded. This means (among other things) that every call to require('foo') will get exactly the same object returned, if it would resolve to the same file.

    Multiple calls to require('foo') may not cause the module code to be executed multiple times.

    https://nodejs.org/api/modules.html

  • (disco) in reply to accalia
    accalia:
    Even IF there really is some batshit insane reason for lodash to be loaded into that many variables
    I would find the dev responsible and make judicious use of this: [image]
  • (disco) in reply to RaceProUK

    well yes, that would be called for i would think.

  • (disco) in reply to RaceProUK

    Green lightsaber! I approve!

  • (disco) in reply to RaceProUK

    I'm sure that some, or most, of you have come across the acronym PEBKAC in relation to Bug / Support writeups. Or perhaps the less flattering "finger trouble" observation.

    That being so. Can I suggest that "judicious use" be in the form as used by various organised (non-legal) affiliations. I.e. One finger at a time, leaving the thumbs until last?

    Hold on though, I have heard the excuse "...all thumbs today...". So perhaps we should start with them and eradicate the issue at the outset?

  • (disco)

    Am I the only one to spot the ReferenceError? I.e. the code should crash anyway when it tries to reference a variable that doesn't exist..

  • (disco) in reply to sehetw
    sehetw:
    } else { _____________________________________ = reqeire('lodash'); }

    But superior formatting also didn't show you this typo...

  • (disco) in reply to accalia
    accalia:
    redwizard:
    Bonus: easier to troubleshoot.

    seriously, i can think of no defensible reason for that monstrosity to exist.

    Even IF there really is some batshit insane reason for lodash to be loaded into that many variables the code at worst should be:

    _ = \
    __ = \
    ___ = \
    ____ = \
    _____ = \
    ______ = \
    _______ = \
    ________ = \
    _________ = \
    __________ = \
    ___________ = \
    ____________ = \
    _____________ = \
    ______________ = \
    _______________ = \
    ________________ = \
    _________________ = \
    __________________ = \
    ___________________ = \
    ____________________ = \
    _____________________ = \
    ______________________ = \
    _______________________ = \
    ________________________ = \
    _________________________ = \
    __________________________ = \
    ___________________________ = \
    ____________________________ = \
    _____________________________ = \
    ______________________________ = \
    _______________________________ = \
    ________________________________ = \
    _________________________________ = \
    __________________________________ = \
    ___________________________________ = \
    ____________________________________ = \
    _____________________________________ = \
    ______________________________________ = \
    _______________________________________ = \
    ________________________________________ = require('lodash');
    

    Pretty! Well, it is in @accalia's post.

  • (disco) in reply to abarker

    i was tempted to play arounjd with the formatting a little more and try to get a christmasholiday tree out of it...

    sanity prevailed this time.

  • (disco) in reply to accalia

    I figure that would be a little difficult due to the number of characters per line not increasing by two each line. Also, I have no idea how to put a star at the top. Follows is my attempt...

    //                 |\/|
    //                /_  _\
    //                  \/
                        _ = \
                       __ = \
                      ___ = \
                      ____ = \
                     _____ = \
                     ______ = \
                    _______ = \
                    ________ = \
                   _________ = \
                   __________ = \
                  ___________ = \
                  ____________ = \
                 _____________ = \
                 ______________ = \
                _______________ = \
                ________________ = \
               _________________ = \
               __________________ = \
              ___________________ = \
              ____________________ = \
             _____________________ = \
             ______________________ = \
            _______________________ = \
            ________________________ = \
           _________________________ = \
           __________________________ = \
          ___________________________ = \
          ____________________________ = \
         _____________________________ = \
         ______________________________ = \
        _______________________________ = \
        ________________________________ = \
       _________________________________ = \
       __________________________________ = \
      ___________________________________ = \
      ____________________________________ = \
     _____________________________________ = \
     ______________________________________ = \
    _______________________________________ = \
    ________________________________________ = require('lodash');
    

    ... Wait, does this make me insnae? I'm pretty sure I'm not insane, since I can ask the question, but insnae? Maybe? :passport_control:

  • (disco) in reply to Tsaukpaetra

    the tree topper looks like an exasperated fox. Perfect.

  • (disco) in reply to Tsaukpaetra
    Tsaukpaetra:
    I figure that would be a little difficult due to the number of characters per line not increasing by two each line. Also, I have no idea how to put a star at the top. Follows is my attempt...
    //               |\/|
    //              /_  _\
    //                \/
                       _ = \
                      __ = \
                      ___ = \
                      ____ = \
                     _____ = \
                     ______ = \
                    _______ = \
                    ________ = \
                   _________ = \
                   __________ = \
                  ___________ = \
                  ____________ = \
                 _____________ = \
                 ______________ = \
                _______________ = \
                ________________ = \
               _________________ = \
               __________________ = \
              ___________________ = \
              ____________________ = \
             _____________________ = \
             ______________________ = \
            _______________________ = \
            ________________________ = \
           _________________________ = \
           __________________________ = \
          ___________________________ = \
          ____________________________ = \
         _____________________________ = \
         ______________________________ = \
        _______________________________ = \
        ________________________________ = \
       _________________________________ = \
       __________________________________ = \
      ___________________________________ = \
      ____________________________________ = \
     _____________________________________ = \
     ______________________________________ = \
    _______________________________________ = \
    ________________________________________ = \
                    require
                   ('lodash');
    

    FTFY

  • (disco) in reply to Tsaukpaetra
    Tsaukpaetra:
    Wait, does this make me insnae?

    i wouldn't know about that.... can you help me get out fot his jacket. the paws are tied around the back....

    Yamikuronue:
    the tree topper looks like an exasperated fox. Perfect.
    indeed, I @accalia do approve!
    riking:
    FTFY

    :clap: -clap- :clap:

    Brava! Brava Ragazza!

  • (disco) in reply to riking
    riking:
    FTFY

    So now that you've assigned all those variables to the require function and evaluated and discarded a string, what are you going to do next?

  • (disco)

    This was a joy to read on my mobile, it just got better and better!

  • (disco) in reply to accalia
    accalia:
    Brava! Brava Ragazza!

    @riking is a woman? TIL ...

  • (disco) in reply to Kuro

    You could use window[underscore] to get rid of the eval.

Leave a comment on “Required”

Log In or post as a guest

Replying to comment #:

« Return to Article