r/javascript • • Nov 24 '17

large image I am the best webdev

Don't blame me for being awesome

(function r() {
  setTimeout(r, Math.random() * 10);
  let el = document.createElement(`div`);
  el.innerHTML = `๐Ÿ†`;
  el.style.position = `absolute`;
  el.style.zIndex = 999999;
  el.style.fontSize = (((Math.random() * 48) | 0) + 16) + `px`;
  el.style.left = ((Math.random() * innerWidth) | 0) + `px`;
  el.style.top = ((Math.random() * (innerHeight + pageYOffset)) | 0) + `px`;
  document.body.appendChild(el);
})();
533 Upvotes

108 comments sorted by

88

u/[deleted] Nov 24 '17

Man, I love eggplant. What a great vegetable. Can I put, let's say, $11M into your Series A?

73

u/346pm Nov 24 '17

Yes, if bathrobes are allowed in personal meetings

2

u/T_O_beats Nov 24 '17

Itโ€™s a fruit! A sneaky fruit.

141

u/GentlyGuidedStroke Nov 24 '17

Hi is this using a machine learning engine?

84

u/346pm Nov 24 '17 edited Nov 25 '17

This is bleeding edge veggie magic, not machine learning

16

u/kor0na Nov 25 '17

Yes. Also blockchain.

17

u/ndboost Nov 24 '17

yes it's powered by SAP Leonardo.

2

u/[deleted] Nov 25 '17

More like machine gun engine. Machine gun for random divs.

2

u/titoonster Nov 25 '17

eggplant no-eggplant

171

u/[deleted] Nov 24 '17

156

u/346pm Nov 24 '17 edited Nov 25 '17

Stop stealing my code this is worth zillion ๐Ÿ’ฒ and copyright by meโ„ขยฉ

48

u/[deleted] Nov 24 '17

97

u/346pm Nov 24 '17 edited May 21 '26

OK guys, since all of you are thiefs, the most recent version is now obfuscated.

(function a(){setTimeout(a,0xa*Math['random']());var b=document['createElement']('div');b['innerHTML']='๐ŸŒฝ';b['style']['position']='absolute';b['style']['zIndex']=0xf423f;b['style']['fontSize']=(0x30*Math['random']()|0x0)+0x10+'px';b['style']['left']=(Math['random']()*innerWidth|0x0)+'px';b['style']['top']=(Math['random']()*(innerHeight+pageYOffset)|0x0)+'px';document['body']['appendChild'](b);}());

25

u/[deleted] Nov 24 '17

4

u/kunokdev Nov 24 '17

Wow this is amazing, what is that? How do you generate such code and why does that work?

13

u/cmgriffing Nov 25 '17

It is called JSF**k. This article about how eBay is/was vulnerable to code injection might help explain things: https://arstechnica.com/information-technology/2016/02/ebay-has-no-plans-to-fix-severe-bug-that-allows-malware-distribution/

7

u/wesdegroot Nov 25 '17

http://www.jsfuck.com

To Convert your own code.

6

u/invisibo Nov 25 '17

Feature request: random sounds to be played when the div element is written to the DOM. Can be web audio sin waves or a fart sound.

23

u/52358 Nov 25 '17

but what if the ๐Ÿ† were rotated and semi transparent?? https://codepen.io/felixmc/pen/LOrwLr

5

u/atomic1fire Nov 25 '17

You can also just copy and paste it into your browser's dev tools console.

3

u/quackmeister Nov 25 '17

My god. It's mesmerizing.

1

u/lkraider Nov 29 '17

(๏พ‰โ—•ใƒฎโ—•)๏พ‰*:๏ฝฅ๏พŸโœง It's like magic!

37

u/[deleted] Nov 24 '17

If you use linear feedback shift registers and hold the eggplant size constant, then you can randomly fill the document entirely without any eggplants overlapping. Much like the way blood would gradually populate all pixels randomly when you died in the original Wolfenstein.

http://datagenetics.com/blog/november12017/index.html

47

u/346pm Nov 24 '17

We are planning to add this as an free option, which can either be purchased or retrieved by viewing our free online ads for ~40 hours.

0

u/[deleted] Nov 24 '17

[deleted]

15

u/[deleted] Nov 25 '17

โ˜๏ธ The intent โ˜๏ธ is to provide ๐Ÿ‘‰๐Ÿ‘จ players with a sense of ๐Ÿ’ช pride ๐Ÿ’ช and ๐Ÿ†accomplishment ๐Ÿ† for ๐Ÿ”“ unlocking ๐Ÿ”“ different ๐Ÿ˜Ž heroes ๐Ÿ˜Ž As for ๐Ÿ’ฐ cost ๐Ÿ’ฐ , we selected initial values based upon ๐Ÿ“Š data ๐Ÿ“Š from the Open Beta and other ๐Ÿ”ง adjustments ๐Ÿ”ง made to milestone ๐Ÿ’ฐ rewards ๐Ÿ’ฐ before ๐Ÿš€ launch ๐Ÿš€. Among other things, we're ๐Ÿ‘€ looking ๐Ÿ‘€ at โš–๏ธ average โš–๏ธ per-player ๐Ÿ‘จ ๐Ÿ‘ฉ credit ๐Ÿ’ธ earn rates ๐Ÿ“ˆ on a daily basis ๐Ÿ“…, and we'll be making constant adjustments ๐Ÿ”ง to ensure that players ๐Ÿ‘จ๐Ÿ‘จ have challenges ๐Ÿ˜ค that are compelling ๐Ÿ˜, rewarding ๐Ÿ’ฐ, and of course attainable ๐Ÿ† via gameplay ๐ŸŽฎ We appreciate the candid ๐Ÿ‘€ feedback, and the passion ๐Ÿ˜ก the community ๐Ÿ‘จ ๐Ÿ‘จ ๐Ÿ‘จ has put forth around the current topics here on Reddit๐Ÿ’ป, our forums ๐ŸŒ and across ๐ŸŒ numerous ๐ŸŒ social media outlets ๐ŸŒ Our team ๐Ÿ‘จ๐Ÿ‘จ๐Ÿ‘จ๐Ÿ‘จ๐Ÿ‘จ will continue to make ๐Ÿ”ง changes ๐Ÿ”ง and monitor ๐Ÿ‘€ community feedback and update everyone as soon ๐Ÿ“… and as ๐Ÿ“… often ๐Ÿ“… as we can. ๐Ÿ‘

19

u/swan--ronson Nov 24 '17

Requires Unicode 6.0 support, which I currently don't have as an edgy Linux haxxor. 2/10 m8.

61

u/346pm Nov 24 '17

We are not responsible for people who are too dumb to understand windows. Won't Fix

5

u/CodeTheWebBlog Nov 25 '17

WHY????? Windows is the worst. I had faith in you before this...

11

u/gelezinislokys Nov 25 '17

LMFAO. Both Linux and MacOS is dead thing. Barely anyone uses it, WinXP > everything else.

24

u/Casey_works Nov 24 '17

I sent this to everyone in my office, but in stealth mode. Thanks.

(function r() {
  setTimeout(r, Math.random() * 10);
  let el = document.createElement(`div`);
  el.innerHTML = '&#x1F346';
  el.style.position = `absolute`;
  el.style.zIndex = 999999;
  el.style.fontSize = (((Math.random() * 48) | 0) + 16) + `px`;
  el.style.left = ((Math.random() * innerWidth) | 0) + `px`;
  el.style.top = ((Math.random() * (innerHeight + pageYOffset)) | 0) + `px`;
  document.body.appendChild(el);
})();    

35

u/grantrules Nov 25 '17

I hope by sent you mean committed to master

4

u/quackmeister Nov 25 '17

Don't want to fork up that branch.

1

u/2Punx2Furious Nov 25 '17

Oh wow, I'd love to do this so much if I didn't need my job.

1

u/FriesWithThat Nov 25 '17

That's pretty IIFE.

1

u/sunsetfantastic Nov 25 '17

Minify it for just a little extra stealth

22

u/Is_At_Work Nov 24 '17

Needs more jQuery

18

u/[deleted] Nov 24 '17

3

u/[deleted] Nov 25 '17

That's not real, is it?

1

u/tanew7391 Nov 29 '17

Honestly, probably

2

u/chneau Nov 25 '17

Here you go

r=Math.random;setInterval(()=>$('<div>๐Ÿ†</div>').css('position','absolute').css('zIndex',999999).css('fontSize',((r()*48))+16).css('left',r()*innerWidth).css('top',r()*(innerHeight+pageYOffset)).appendTo('body'),r()*10)

19

u/BlueHeartBob Nov 24 '17

how do i install via npm?

43

u/[deleted] Nov 24 '17

npm install ๐Ÿ† --save

but brace yourself for about a million libraries overhead

0

u/[deleted] Nov 24 '17

[deleted]

11

u/[deleted] Nov 24 '17

sounds like a bug in the spec, thought you could rock the newest unicode in urls now

17

u/moneckew Nov 24 '17

Hi, im interested in buying this software for our enterprise. Are you considering selling?

22

u/grantrules Nov 25 '17

You're a corporation. Steal it then sue the author.

15

u/mayhempk1 Nov 24 '17

hello sir how to convert to typescript? kindly thanks

2

u/lkraider Nov 29 '17

Please OP do the needful

7

u/amgin3 Nov 25 '17

Why are you using Math.random()*10 on the setTimeout? The value will always be less than 10 milliseconds, too fast for any randomness to be noticeable. Just use a constant number if you're going to have it so fast and save some overhead.

2

u/gelezinislokys Nov 25 '17

And if you do it that fast, just use raf

6

u/[deleted] Nov 25 '17

Also, Math.random does not provide cryptographic-grade randomness which is essential for this kind of app. An end user might well be able to predict future positions in advance.

0

u/gelezinislokys Nov 25 '17

You dropped this: /s

3

u/[deleted] Nov 26 '17

Who's being sarcastic?

1

u/gelezinislokys Nov 26 '17

It stand for serious, not sarcasm.

6

u/Le_9k_Redditor Nov 24 '17

Ok so you're saying I should put this in a major project and have it set to only go off on april the first?

6

u/neophilus77 Nov 25 '17

Can you provide HTML5 version please client wants to do mobile

5

u/drowsap Nov 25 '17

Why not setInterval?

2

u/defproc Nov 27 '17

Time is random per trigger. Sort of.

4

u/i_pk_pjers_i Nov 24 '17

Holy fucking shit, that is the best code I have ever seen. YES!

4

u/enchufadoo js truck driver Nov 24 '17

TIL I can read code and see it like a musician reads sheet music and hears it.

3

u/scrogu Nov 25 '17

I added random rotation:

(function r() {
setTimeout(r, Math.random() * 10);
let el = document.createElement(`div`);
el.innerHTML = `๐Ÿ†`;
el.style.position = `absolute`;
el.style.zIndex = 999999;
el.style.fontSize = (((Math.random() * 48) | 0) + 16) + `px`;
el.style.left = ((Math.random() * innerWidth) | 0) + `px`;
el.style.top = ((Math.random() * (innerHeight + pageYOffset)) | 0) + `px`;
el.style.transform = `rotateZ(${Math.random() * 360}deg)`
document.body.appendChild(el);
})();

3

u/iroxjsr0011 Nov 25 '17

For those who want to see multicolored ๐Ÿ† here

    (function r() {
      setTimeout(r, Math.random() * 10);
  let el = document.createElement("div");
  el.innerHTML = `๐Ÿ†`;
  el.style.position = `absolute`;
  el.style.zIndex = 999999;

  el.style.color='#'+(Math.random()*0xFFFFFF<<0).toString(16);
  el.style.fontSize = (((Math.random() * 48) | 0) + 16) + `px`;
   el.style.left = ((Math.random() * innerWidth) | 0) + `px`;
  el.style.top = ((Math.random() * (innerHeight + pageYOffset)) | 0) + `px`;
  document.body.appendChild(el);
})();

5

u/[deleted] Nov 25 '17

you can fuck my wife

2

u/[deleted] Nov 24 '17

Entered this in the console. Am not dissapointed

2

u/Palladog Nov 25 '17

That is absolutely glorious. Thank you for this beautiful imagery.

1

u/IllegalThings Nov 24 '17

Reminds me of the cornify plugin

1

u/mcfrankline Nov 25 '17

2

u/tippr Nov 25 '17

u/346pm, your post was gilded in exchange for 0.00154572 BCH ($2.50 USD)! Congratulations!


^^Howย toย use | ^^Whatย isย Bitcoinย Cash? | ^^Whoย acceptsย it? | Powered by Rocketr | r/tippr
Bitcoin Cash is what Bitcoin should be. Ask about it on r/btc

1

u/Headless_Slayer Nov 25 '17

my eyes are bleeding

1

u/sittingprettyin Nov 25 '17

Can we get an npm module please.

1

u/[deleted] Nov 25 '17

It's a good start. How much time do you need to get this doing accounts?

1

u/sylario Nov 25 '17

From what I understand it should recursively call itself infinitely without ever reaching the third line. What am i missing?

1

u/_poor Nov 25 '17

setTimeout places the callback to the side (event queue) and execution will continue as normal. The recursive call you mention will only happen after the code which is currently executing finishes, in addition to the duration passed to setTimeout.

1

u/williwood Nov 25 '17

this made me laugh. thank you

1

u/nikaone Nov 25 '17

I copycat from all of you, and add a Japanese meme, https://codepen.io/jacobsun/full/POBZJr/ ,

1

u/Tvde1 Apr 27 '18

This will never start

1

u/batmansmk Nov 24 '17

Purple rain, purple raiiiin!

1

u/atomic1fire Nov 25 '17

Nah dude, this should be purple rain.

https://codepen.io/anon/pen/BmVeBK

3

u/CodeTheWebBlog Nov 25 '17

Its still blue, you should use a filter: https://codepen.io/Booligoosh/pen/wPXbqd

That's better

1

u/DOG-ZILLA Nov 25 '17

In jQuery please.

2

u/MechaAaronBurr Nov 25 '17

Needs to be in Prototype.js before it can go into production.

0

u/zubair1024 Nov 25 '17

This is freaking awesome!

PS this is my first comment on reddit.

-2

u/nightness Nov 25 '17

Best is subjective. Best because you can make a nice solution in a short period of time, or because you make the best solution in a reasonable about of time.

0

u/[deleted] Nov 24 '17

[deleted]

14

u/unknownmosquito Nov 24 '17

Geeze I thought this was r/programmerhumor until I read your comment

0

u/[deleted] Nov 24 '17

[deleted]

11

u/Soccham Nov 24 '17

I think it needs more

20

u/Le_9k_Redditor Nov 24 '17

Eggplant enterprise edition

5

u/grantrules Nov 25 '17

Free for open source projects, 10-100 user installation with enterprise support for $2,500/mo + $10/mo/install

8

u/evenisto Nov 25 '17

What is this const and arrow stuff? This feature is critical and it needs to support legacy browsers as well. We need battle-tested syntax and solutions.

10

u/_poor Nov 25 '17

Our Babel ES6 rollup parmesan webpack gulpify stage-0 broccoli step should transpile the code to work on legacy browsers... I think

6

u/evenisto Nov 25 '17

Transpilation? No, that's out of the question. We settled for straightforward deployment strategy of putting it in a <script> tag, we have already trained our team and we don't want it all go to waste.

0

u/[deleted] Nov 25 '17

[deleted]

3

u/sunsetfantastic Nov 25 '17

This is fantastic

Although I can't see a lot of changes, the code is very similar

0

u/[deleted] Nov 24 '17

[deleted]

1

u/Thecrawsome Nov 24 '17

ANIME IS REAL TO ME

0

u/[deleted] Nov 24 '17

[deleted]

10

u/BlueHeartBob Nov 24 '17

It is if you want it to display over everything on a normal page.

4

u/dangerzone2 Nov 24 '17

Happy holidays NEWB!!!

3

u/[deleted] Nov 25 '17 edited Nov 25 '17

[removed] โ€” view removed comment

3

u/TheHelgeSverre Nov 25 '17

It's what the young ones calls an "Emojii" (unicode), watch this, it explains it well: https://www.youtube.com/watch?v=tITwM5GDIAI, the eggplant specifically: https://emojipedia.org/aubergine/

1

u/[deleted] Nov 25 '17

[removed] โ€” view removed comment

2

u/TheHelgeSverre Nov 25 '17

Yes ๐Ÿ†, it is just a character, just like - %, & or โ– 

1

u/[deleted] Nov 25 '17 edited Nov 25 '17

[removed] โ€” view removed comment

2

u/TheHelgeSverre Nov 26 '17

No there is no trickery, โ– โ– โ– โ– โ– โ– โ– โ– โ– โ–  just try to copy paste this character into notepad, it is just as valid of a character/letter as "A" or "?"

1

u/[deleted] Nov 27 '17

[removed] โ€” view removed comment