- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Admin
-1 not enough jquery
Admin
What is that Unicode symbol above the ProGet ad?
Admin
Admin
Superior code formatting shows a bug in line 39 which repeats the condition of line 38
Admin
...and the call to reqeire()
Admin
_____________________________________ = reqeire('lodash');
:grimacing:
:hanzo:
Admin
I think I want to require that this pattern not occur in my codebase.
Admin
How do you call stuff on it then? Do you have to do another 40 levels of if every time?
Admin
Clearly a loop is in order here:
Filed Under: #obviousSolution
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!
Admin
Admin
Now I know why ultra-wide monitors are getting more popular...
Admin
It's practically a reqeirement for code like that.
Admin
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)
Admin
FTFTSOS
Admin
Can someone explain why anyone, no matter how feeble-minded, would do this?
Admin
It is their last day at work
Admin
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
baitstemptsallowsencourages those moreOCDishgunghoidlecapable to do it for you. :grin:Admin
Clearly this should be corrected to:
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!
Admin
I was going to manufacture fabulous post, butttttttttt unique lengths wordzzzzzz difficult.
(Darn namespaces.)
Admin
or
dieget stuck in a terrible infinite loop trying?Admin
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.
Admin
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:
https://nodejs.org/api/modules.htmlAdmin
Admin
well yes, that would be called for i would think.
Admin
Green lightsaber! I approve!
Admin
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?
Admin
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..
Admin
But superior formatting also didn't show you this typo...
Admin
Pretty! Well, it is in @accalia's post.
Admin
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.
Admin
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...
... 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:
Admin
the tree topper looks like an exasperated fox. Perfect.
Admin
FTFY
Admin
i wouldn't know about that.... can you help me get out fot his jacket. the paws are tied around the back....
indeed, I @accalia do approve!:clap: -clap- :clap:
Brava! Brava Ragazza!
Admin
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?Admin
This was a joy to read on my mobile, it just got better and better!
Admin
@riking is a woman? TIL ...
Admin
You could use
window[underscore]
to get rid of theeval
.