Skip to content

Instantly share code, notes, and snippets.

@smcllns
Last active December 25, 2025 18:15
Show Gist options
  • Select an option

  • Save smcllns/8b727361ce4cf55cbc017faaefbbf951 to your computer and use it in GitHub Desktop.

Select an option

Save smcllns/8b727361ce4cf55cbc017faaefbbf951 to your computer and use it in GitHub Desktop.
A valid URL you can bookmark and paste into address bar for quickly taking notes and saving to a .txt file.
data:text/html,
<html>
<head>
<meta name="viewport" content="width=device-width,initial-scale=1" />
<style>
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
background: rgba(245, 245, 245, 1);
display: flex;
flex-direction: column;
height: 100vh;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
padding: 1rem;
}
aside {
display: flex;
align-items: center;
gap: 0.75rem;
margin-bottom: 1rem;
}
header {
flex: 1;
color: rgba(51, 51, 51, 1);
font-size: 0.9rem;
font-weight: 500;
}
button {
background: rgba(0, 122, 255, 1);
color: rgba(255, 255, 255, 1);
border: none;
padding: 0.5rem 1rem;
border-radius: 6px;
cursor: pointer;
font-size: 0.875rem;
font-weight: 500;
}
button:hover {
background: rgba(0, 81, 213, 1);
}
textarea {
flex: 1;
width: 100%;
max-width: 50rem;
background: rgba(255, 255, 255, 1);
border: 1px solid rgba(224, 224, 224, 1);
border-radius: 8px;
padding: 1.25rem;
font-size: 1rem;
line-height: 1.6;
font-family: inherit;
resize: both;
margin: 0 auto;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
textarea:focus {
outline: none;
border-color: rgba(0, 122, 255, 1);
box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}
</style>
</head>
<body>
<aside>
<header></header>
<button>Save</button><a hidden>Download</a>
</aside>
<textarea contenteditable autofocus placeholder="Type notes"></textarea>
<script>
const save = document.querySelector("aside button"),
link = document.querySelector("aside a"),
title = document.querySelector("aside header"),
note = document.querySelector("textarea"),
date = new Date(),
datePretty = `${date.getFullYear()}-${(date.getMonth() + 1)
.toString()
.padStart(2, "0")}-${date
.getDate()
.toString()
.padStart(2, "0")} ${date
.getHours()
.toString()
.padStart(2, "0")}:${date.getMinutes().toString().padStart(2, "0")}`;
title.innerText = datePretty;
const download = (e) => {
const data = new Blob([note.value], { type: "text/plain" });
link.href = window.URL.createObjectURL(data);
link.download = `${datePretty}.txt`;
link.click();
};
save.addEventListener("click", download);
window.addEventListener("beforeunload", download);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment