From e61204166cd0212efa99249982800d44f4bd7e53 Mon Sep 17 00:00:00 2001 From: Hayley Parra Date: Sat, 13 May 2023 23:38:14 -0700 Subject: [PATCH] programming can be fun again --- README.md | 2 -- notes/bookmarklets.md | 65 +++++++++++++++++++++++++++++++++++++++++++ notes/jekyll.md | 2 ++ notes/postmortem.md | 4 +++ notes/snes.md | 26 +++++++++++++++++ 5 files changed, 97 insertions(+), 2 deletions(-) create mode 100644 notes/bookmarklets.md create mode 100644 notes/jekyll.md create mode 100644 notes/postmortem.md create mode 100644 notes/snes.md diff --git a/README.md b/README.md index ac56555..58d2294 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,4 @@ # HGPA -1982 - - - [notes](notes/README.md) - [journal](journal/README.md) diff --git a/notes/bookmarklets.md b/notes/bookmarklets.md new file mode 100644 index 0000000..6363108 --- /dev/null +++ b/notes/bookmarklets.md @@ -0,0 +1,65 @@ +# bookmarklets + +these things have been around for a long time! +javascript has changed too! + +## copy a markdown link + +```js +javascript:(async function copyMarkdownLink(s) { + /* copy a markdown link with page title and href to the clipboard */ + const mdLink = `[${document.title}](${window.location.href})`; + const type = 'text/plain'; + const blob = new Blob([mdLink], { type }); + const data = [new ClipboardItem({ [type]: blob })]; + await navigator.clipboard.write(data); +})(); +``` + +## copy a markdown citation + +i would like to create a citation using a format that i like. + +i can use page href, title and description, but many pages have additional data. +some pages have JSON-LD tags and many more have open-graph meta tags. + +```js +javascript:(async function copyMarkdownCitation(s) { + /* copy a markdown link and page citation to the clipboard */ + function meta(q) { + const el = document.querySelector(`meta${q}`); + return el && el.content || null; + } + const c = { + title: meta('[property="og:title"]') || document.title, + href: meta('[property="og:url"]') || window.location.href, + author: meta('[name="author"]'), + siteName: meta('[property="og:site_name"]') || window.location.hostname, + description: meta('[name="description"]'), + }; + switch (window.location.hostname) { + case 'en.wikipedia.org': + c.title = document.title.split(' - ')[0]; + c.author = 'Wikipedia'; + break; + case 'developer.mozilla.org': + c.title = document.title.split(' | ')[0]; + c.author = 'MDN'; + default: + break; + } + const mdLink = `[${c.title}](${c.href}). ${c.author}. ${c.siteName}.`; + const type = 'text/plain'; + const blob = new Blob([mdLink], { type }); + const data = [new ClipboardItem({ [type]: blob })]; + await navigator.clipboard.write(data); +})(); +``` + +## references + +[Bookmarklet](https://en.wikipedia.org/wiki/Bookmarklet). Wikipedia. en.wikipedia.org. + +[Bookmarklets are Dead…](https://medium.com/making-instapaper/bookmarklets-are-dead-d470d4bbb626). Brian Donohue. Medium. + +[Clipboard: write() method - Web APIs](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/write). MDN. developer.mozilla.org. diff --git a/notes/jekyll.md b/notes/jekyll.md new file mode 100644 index 0000000..870e788 --- /dev/null +++ b/notes/jekyll.md @@ -0,0 +1,2 @@ +# jekyll + diff --git a/notes/postmortem.md b/notes/postmortem.md new file mode 100644 index 0000000..b06fdd8 --- /dev/null +++ b/notes/postmortem.md @@ -0,0 +1,4 @@ +# postmortem + +## references + diff --git a/notes/snes.md b/notes/snes.md new file mode 100644 index 0000000..a546ec4 --- /dev/null +++ b/notes/snes.md @@ -0,0 +1,26 @@ +# Super Nintendo Entertainment System (SNES) + +an absolute joy. + +## favorites + +- Actraiser +- Chrono Trigger +- Donkey Kong Country +- Final Fantasy III (VI) +- F-Zero +- Mario Paint +- NBA Jam +- The Legend of the Mystical Ninja +- The Legend of Zelda: A Link to the Past +- StarFox +- Street Fighter II +- Super Bomberman +- Super Mario Kart +- Super Mario RPG +- Super Mario World +- UN Squadron + +## references + +[Random: Shinji Mikami Had To Ban The Resident Evil Devs From Playing Tetris Attack](https://www.nintendolife.com/news/2019/10/random_shinji_mikami_had_to_ban_the_resident_evil_devs_from_playing_tetris_attack). lol.