Skip to content

Instantly share code, notes, and snippets.

@nevkontakte
Last active September 23, 2020 10:54
Show Gist options
  • Save nevkontakte/16ff6d7fc37a9e18213beef6fd9373a9 to your computer and use it in GitHub Desktop.
Save nevkontakte/16ff6d7fc37a9e18213beef6fd9373a9 to your computer and use it in GitHub Desktop.
Browser scratchpad using ACE editor (https://ace.c9.io/)
data:text/html;charset=utf-8,
<title>ScratchPad</title>
<link rel="shortcut icon" type="image/png" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAACYQAAAmEBwTBV+gAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAALVSURBVDiNpZVdSJNRHMaf993aJnvzFc9xLpXhppvIJkUGpgMjjBKCQkdRgjHQiLrpJqmwK7upW7sJIoqCAvu4tKLVTRCTSisaSAPbpg2dtZxb07mPfzcqan5s7sAD5z2c8+P5P+fjBREhXzHGCiRJemu32x/39vYyIoJARMintbe3a1Uq1XuXy2XQarVz09PT4YqKiiYxHyjnXBEMBp87HI46p9NZoFard8myrPV6vbfzKV9gjN1jjMWbm5sjQ0ND1NfX91cUxVkAD/IB9zPGEiaTacpsNlNjY2N4cHAw3dnZ+QWAYltRcM6vAziv0+l+KxQKXTKZ/ON2uxe6urreJRIJOxGlc948znkPgBvV1dWT4XC4LJVKxXw+3wwR+TQazZG5ubk4AOTkmHN+DsBNq9X6MxwOl6XT6Xm/3z9NRCHO+dElKIDsjxvnvAPAQ4PBEIjFYpWZTGZhcnJy3Gg0KqPR6D6fz/dr5fyswJzzYwCeMcb8RFRFROlEIvGDiDSFhYUNHo8nuHbNllFwzlsADEiSNAagiogoFAqN6vX64vLy8kPrQbd0zDlvBPBarVZPSJJUQ0SIxWLfbDabcXR0tCEQCHg2WruhY875bgCDSqVyGRqPx7+aTKaqYDDYuhl0Q8fFxcU2URTfKBSKmaKiIgsRIRqNftbr9bWRSOT42NjYq82g6zoWBEGw79/rUiqV87IsWxbLH7FYLLaJiYmT2UAB4L+reqaj7fK41009F51Js9mckWV5WKfTpSorK525XPnVH4D46H7/7PfhAfr4spcuddcvAEgDOJvrW7Iqis7TbVfrbSU7I1PDiIRGYChNZQ42VV0jojtZlb9eFADUpxwtiQ8vrtCTW4cz3SdqngIo2O7rt9yx1hrvAqDWA8ZAw54Sc76/qyW3OwwV7FNdTemFfIFLEogIgiAUASgDwACoAAiLSWVWKLmoFICFNVo5ngSQ/gdt0bxpUDJ4dgAAAABJRU5ErkJggg=="/>
<style>html, body { margin: 0; padding: 0; }</style>
<body contenteditable></body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.12/ace.js" integrity="sha512-GZ1RIgZaSc8rnco/8CXfRdCpDxRCphenIiZ2ztLy3XQfCbQUSCuk8IudvNHxkRA3oUg6q0qejgN/qqyG1duv5Q==" crossorigin="anonymous"></script>
<script>
var e = ace.edit(document.body);
e.setTheme("ace/theme/tomorrow_night_eighties");
e.setOptions({fontSize: "12pt"});
e.setValue("");
</script>
@nevkontakte
Copy link
Author

What is this?

This little snippet allows you to use your browser tab as a scratchpad. It uses ACE editor JS library to provide fancy editing features. Inspired by lifehacker.com.

How to use this?

Create a new bookmark and paste gist contents into the address field. To use it open up a new browser tab and click on the bookmark. Enjoy!

How it works?

Through the magic of data URIs.

What about privacy?

As long as we trust ACE editor not to send it's contents away to Mallory, this should be private enough for normal use. It doesn't persist editor contents anywhere and same-origin policy prevents it from leaking. SRI guarantees that ACE editor library was not tampered with (all modern browsers support it).

However, if you're dealing with state secret or something, please do not use it. I take no responsibility for anything like this.

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