mirror of github:amycatgirl/amycatgirl.github.io
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore: autogenerate noscript fallback

Amy 23792f84 40532c6a

+75 -8
+25 -8
index.html
··· 15 15 <p>currently aiding <a href="https://github.com/stoatchat">stoat.chat</a> with fixing bugs and cosplaying as a 16 16 support agent</p> 17 17 18 - <p>i can work with javascript and typescript. but i am a quick learner, and have worked with python, kotlin, java, nix, clojure, and lisp dialects like common lisp and scheme.</p> 18 + <p>i can work with javascript and typescript. but i am a quick learner, and have worked with python, kotlin, 19 + java, nix, clojure, and lisp dialects like common lisp and scheme.</p> 19 20 <h2>my projects</h2> 20 21 <ul> 21 22 <li><a href="https://github.com/amycatgirl/codehub">codehub</a> (go)</li> ··· 36 37 <p>i also have a blog on <a href="https://amybunny.leaflet.pub">leaflet</a>, here are it's latest entries:</p> 37 38 <div id="atproto-leaflet"> 38 39 <noscript> 39 - <p> 40 - it seems your browser doesn't support javascript, this section is dynamic so it won't render. 41 - </p> 40 + <div class="entry"> 41 + <a class="base-anchor" href="https://amybunny.leaflet.pub/3mbqvkp6l6c27"></h3 class="title">my 2026 42 + bucket 43 + list</h3></a> 44 + <p class="description">things that i want to do this year</p> 45 + <div class="metadata"> 46 + <time datetime="2026-01-06T11:57:30.149Z" class="published-at">06/01/2026, 07:57</time> 47 + </div> 48 + </div> 42 49 </noscript> 43 50 </div> 44 51 </main> ··· 79 86 grid-area: content; 80 87 } 81 88 82 - ul { padding-left: 1rem;} 83 - li::marker { content: "* "; } 89 + ul { 90 + padding-left: 1rem; 91 + } 92 + 93 + li::marker { 94 + content: "* "; 95 + } 84 96 85 97 .margin-wrapper { 86 98 z-index: 1; ··· 108 120 109 121 a { 110 122 color: var(--emphasis); 111 - & h3 { color: var(--fg); } 123 + 124 + & h3 { 125 + color: var(--fg); 126 + } 112 127 } 113 128 114 129 .entry { ··· 170 185 171 186 <template id="leaflet-entry"> 172 187 <div class="entry"> 173 - <a class="base-anchor" href="#"><h3 class="title"></h3></a> 188 + <a class="base-anchor" href="#"> 189 + <h3 class="title"></h3> 190 + </a> 174 191 <p class="description"></p> 175 192 <div class="metadata"> 176 193 <time class="published-at"></time>
+50
leaflet-fallback.el
··· 1 + ;; -*- lexical-binding: t; -*- 2 + (defconst atproto-collection-nsid "pub.leaflet.document") 3 + (defconst atproto-user-did "did:plc:gijpvbkdbr56kazbdjhfvb3d") 4 + (defconst atproto-pds "https://porcini.us-east.host.bsky.network") 5 + (defconst max-entries 5) 6 + 7 + (defun search-leaflet-fallback-block () 8 + ) 9 + 10 + (defun at-datetime->timestamp (dt) 11 + (date-to-time dt)) 12 + 13 + (defun timestamp->humanreadable-string (ts) 14 + (format-time-string "%d/%m/%Y, %H:%M" ts)) 15 + 16 + (defun build-leaflet-html-entry (title description date date-humanreadable url) 17 + (format "<div class=\"entry\">\n<a class=\"base-anchor\" href=\"https://amybunny.leaflet.pub/%s\"></h3 class=\"title\">%s</h3></a>\n<p class=\"description\">%s</p>\n<div class=\"metadata\">\n<time datetime=%S class=\"published-at\">%s</time>\n</div>\n</div>" url title description date date-humanreadable)) 18 + 19 + (defun fetch-latest-entries () 20 + (let ((url-request-method "GET") 21 + (endpoint (concat atproto-pds "/xrpc/com.atproto.repo.listRecords?repo=" atproto-user-did "&collection=" atproto-collection-nsid "&limit=" (number-to-string max-entries)))) 22 + (with-current-buffer (url-retrieve-synchronously endpoint) 23 + (goto-char 0) 24 + (search-forward "\n\n") 25 + (gethash "records" (json-parse-string (buffer-substring (point) (point-max))))))) 26 + 27 + (defun build-elements-from-entries (seq) 28 + (mapcar (lambda (rec) 29 + (let* ((document-info (gethash "value" rec)) 30 + (url (car (last (string-split (gethash "uri" rec) "\/+"))))) 31 + (build-leaflet-html-entry 32 + (gethash "title" document-info) 33 + (gethash "description" document-info) 34 + (gethash "publishedAt" document-info) 35 + (timestamp->humanreadable-string (at-datetime->timestamp (gethash "publishedAt" document-info))) 36 + url))) 37 + seq)) 38 + 39 + (with-current-buffer "index.html" 40 + (save-excursion 41 + (goto-char 0) 42 + (let ((block-start (search-forward "<noscript>" nil t)) 43 + (block-end (- (search-forward "</noscript>" nil t) 11))) 44 + (delete-region block-start block-end) 45 + (goto-char (- (point) 11)) 46 + (insert "\n") 47 + (dolist (element (build-elements-from-entries (fetch-latest-entries))) 48 + (insert (concat element "\n"))) 49 + (indent-region block-start (search-forward "</noscript>" nil t))))) 50 +