r/funny •

Pidgonacci Sequence

[deleted] — view deleted post

0 Upvotes

22k comments sorted by

View all comments

-1

u/[deleted] Jun 09 '12

This will get buried, but I hope at least a few of you guys try this out.

Type this into your browser bar

javascript:

Then paste this:

*function toFixed(x) {if (Math.abs(x) < 1.0) {var e = parseInt(x.toString().split('e-')[1]); if (e) {x = Math.pow(10,e-1);x = '0.' + (new Array(e)).join('0') + x.toString().substring(2);}} else {var e = parseInt(x.toString().split('+')[1]);if (e > 20) {e -= 20;x /= Math.pow(10,e);x += (new Array(e+1)).join('0');}}return x;}var e = $( document.createElement('div') ); e.css({'position' : 'fixed', 'top' : '10%', 'left' : '20%', 'height' : '80%', 'width' : '60%', 'background-color' : '#000', 'text-align' : 'center', 'font-size' : '10em', 'color' : '#fff', 'padding-top' : '5%', 'word-wrap' : 'break-word'}); $('body').append(e); var num1 = 0; var num2 = 1; e.text(num1); setInterval(function() {e.text(toFixed(num2)); var temp = num1; num1 = num2; num2 = num2 + temp; }, 300);

or paste this if you want scientific notation:

var e = $( document.createElement('div') ); e.css({'position' : 'fixed', 'top' : '10%', 'left' : '20%', 'height' : '80%', 'width' : '60%', 'background-color' : '#000', 'text-align' : 'center', 'font-size' : '10em', 'color' : '#fff', 'padding-top' : '5%', 'word-wrap' : 'break-word'}); $('body').append(e); var num1 = 0; var num2 = 1; e.text(num1); setInterval(function() {e.text(num2); var temp = num1; num1 = num2; num2 = num2 + temp; }, 300);

1

u/Daveyd325 Jun 09 '12

I'll go ahead and be grateful if some brave soul verifies this first.

1

u/[deleted] Jun 09 '12

I guess it's hard for me to convince you(unless you know a bit about programming languages), but I'll try.

Javascript is a client side language. This means that if you were to put this code into the bar, the program would run on your computer, not some server, not on reddit, etc. Secondly, I can't do anything malicious through javascript, unless I somehow got your information and sent it to myself. You can look through the code, there are no links, no emails, etc. It's just math.

1

u/TigerWylde Jun 09 '12

did nothing.

1

u/[deleted] Jun 09 '12

Huh? It works for me, what browser are you using? first you type, "javascript: " without the quotes. Then after that, paste the code. So it will read, "javascript: code code blah blah blah" without quotes.