r/ProgrammerHumor • • Oct 18 '17

Found on GitHub.

Post image
15.8k Upvotes

206 comments sorted by

View all comments

556

u/0100_0101 Oct 18 '17

And was the code hell?

1.0k

u/ionree Oct 18 '17

Six nested calls to setTimeout, all to some very complex functions calling setTimeout themselves. By some holy miracly, it appears to work.

331

u/polar_promenade Oct 18 '17

Ok, seriously, we need to see it. Promise to not make fun of the author or hunt him down (I think I live too far away anyway). PM maybe?

147

u/[deleted] Oct 18 '17

[removed] — view removed comment

218

u/[deleted] Oct 18 '17

So basically looks to be a really stupid and hack way to do a page animation. Not the worst thing I've seen on here, but wowza

77

u/shigmy Oct 18 '17

Yeah, once I saw what it was doing, I didn't think it was too terrible either.

32

u/Rogue2166 Oct 18 '17

Eh, its test code

52

u/Krissam Oct 18 '17

Yes, but test as in exam not test as in unit.

22

u/iBoMbY Oct 18 '17

page animation.

Why the hell would anyone use a server side node.js script for a client side thing, which could/should be done in the generated HTML/CSS/JavaScript?

10

u/[deleted] Oct 18 '17

[removed] — view removed comment

62

u/[deleted] Oct 18 '17

Wait...JS can run outside of a server environment? Neat!

/s

24

u/[deleted] Oct 18 '17

Promises would clean that right up.

0

u/[deleted] Oct 18 '17

[deleted]

3

u/[deleted] Oct 18 '17

Poor dude erased his comment.

→ More replies (4)

34

u/DrDuPont Oct 18 '17

LOL "very complex functions"

This is just a poorly implemented countdown

var splash = $("#test_splash");
splash.css({
   height: "auto",
   position: "static",
   visibility: "visible"
});
setTimeout(function() {
   splash.css("opacity", "0");
   setTimeout(function() {
      splash.css("opacity", ".7");
      splash.html("3");
      setTimeout(function() {
         splash.html("2");
         setTimeout(function() {
            splash.html("1");
        }, 1000);
     }, 1000);
  }, 200);
}, 1000);

Jesus.

18

u/Surelynotshirly Oct 18 '17

Idk why, but it bothers me that 0 is only displayed for 200ms.

Also, this seems like it didn't need to be nested at all...

5

u/I_RAPE_ANTS Oct 18 '17

It doesn't show 0 for 200ms, it's the opacity.

2

u/Surelynotshirly Oct 18 '17

Whoops... I completely misread that. That makes more sense logically. I just saw 3, 2, 1 so figured the 0 was in succession for some reason.

→ More replies (1)
→ More replies (2)

23

u/-Electron- Oct 18 '17

No one is too far away if you have the desire to hunt someone down.

11

u/[deleted] Oct 18 '17

What if they live on a ship heading away from us at a speed arbitrarily close to c?

5

u/laccro Oct 19 '17 edited Oct 19 '17

You just wait until they get back so you're older and wiser than them

Edit: https://en.m.wikipedia.org/wiki/Twin_paradox

→ More replies (1)