Skip to content

Instantly share code, notes, and snippets.

@pschfr
Last active October 12, 2018 19:12
Show Gist options
  • Save pschfr/81af7b817b38be47ebd966ab94aa01eb to your computer and use it in GitHub Desktop.
Save pschfr/81af7b817b38be47ebd966ab94aa01eb to your computer and use it in GitHub Desktop.
One line data:text/html calculator from https://twitter.com/MaximeEuziere/status/1050823405728088065
<body onload='for(s of"C/=.0 *321 -654 +987 ")i.outerHTML+=s<"!"?"<p>":`<button onclick=F("${s}")>`+s;F=b=>i.value=z=b>"B"?(c=d=o="",a=r=p=0):1+b-0?c+=b-.1?b:d?"":d=b:(q=b<"=",p?r=c:a=c||a,r=q?p&&r:r||a,a=o&&r?z=eval(a+o+s+r):a,o=q?b:o,p=q,d=c="",q?z:a);F`C`'><input id=i>
@pschfr
Copy link
Author

pschfr commented Oct 12, 2018

From https://twitter.com/MaximeEuziere/status/1050823405728088065. Copy this, go to your URL bar and type `data:text/html,' and then paste and hit enter. Be amazed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment