From 82604bd42bbf8c7a1d9d27b8ef5fe7cb26e225fb Mon Sep 17 00:00:00 2001 From: Cory Dransfeldt Date: Sun, 12 Mar 2023 11:17:56 -0700 Subject: [PATCH] cleanup + now topper --- ...venty-fetch-1cce4ddcbc732998e95932ffce6c63 | 1 + ...-fetch-1cce4ddcbc732998e95932ffce6c63.json | 1 + ...venty-fetch-8acdd9ef0f147dd2cc625c51fb3557 | 1 + ...-fetch-8acdd9ef0f147dd2cc625c51fb3557.json | 1 + .eleventy.js | 20 +++++++--- config/dateFilters.js | 40 +++++++++++++++++++ config/filters.js | 4 ++ package.json | 3 ++ src/_data/nowplaying.js | 15 +++++++ src/_data/status.js | 11 +++++ src/_includes/now-topper.liquid | 6 +++ src/index.html | 4 +- .../automatic-feedbin-subscription-backups.md | 0 .../leaving-google-apps-for-fastmail.md | 0 .../syncing-osx-app-preferences-dot-files.md | 0 .../generating-responsive-css-grid-neat.md | 0 .../clearing-mod-pagespeed-cache.md | 0 .../updating-to-latest-git-ubuntu.md | 0 .../ssh-directory-permissions.md | 0 src/posts/{data => 2021}/2021-reading-list.md | 0 .../{data => 2021}/a-brief-intro-to-git.md | 0 .../apple-music-a-tale-of-woe.md | 0 .../{data => 2021}/digital-privacy-tools.md | 0 src/posts/{data => 2022}/2022-reading-list.md | 0 .../apple-centric-digital-privacy-tools.md | 0 .../apple-messages-a-tale-of-woe.md | 0 .../automating-email-cleanup-in-gmail.md | 0 .../fixing-safari-icloud-syncing.md | 0 .../{data => 2022}/migrating-to-fastmail.md | 0 .../simple-api-fetch-hooks-with-swr.md | 0 ...nt-side-rendered-webmentions-to-my-blog.md | 0 ...omating-and-overengineering-my-now-page.md | 0 ...ting-rss-syndication-with-nextjs-github.md | 0 ...a-now-page-using-nextjs-and-social-apis.md | 0 .../client-side-webmentions-in-nextjs.md | 0 ...ail-with-regex-filters-now-with-chatgpt.md | 0 tailwind.css | 14 +++++++ yarn.lock | 10 +++++ 38 files changed, 123 insertions(+), 8 deletions(-) create mode 100644 .cache/eleventy-fetch-1cce4ddcbc732998e95932ffce6c63 create mode 100644 .cache/eleventy-fetch-1cce4ddcbc732998e95932ffce6c63.json create mode 100644 .cache/eleventy-fetch-8acdd9ef0f147dd2cc625c51fb3557 create mode 100644 .cache/eleventy-fetch-8acdd9ef0f147dd2cc625c51fb3557.json create mode 100644 config/dateFilters.js create mode 100644 src/_data/nowplaying.js create mode 100644 src/_data/status.js create mode 100644 src/_includes/now-topper.liquid rename src/posts/{data => 2014}/automatic-feedbin-subscription-backups.md (100%) rename src/posts/{data => 2014}/leaving-google-apps-for-fastmail.md (100%) rename src/posts/{data => 2015}/syncing-osx-app-preferences-dot-files.md (100%) rename src/posts/{data => 2016}/generating-responsive-css-grid-neat.md (100%) rename src/posts/{data => 2017}/clearing-mod-pagespeed-cache.md (100%) rename src/posts/{data => 2017}/updating-to-latest-git-ubuntu.md (100%) rename src/posts/{data => 2020}/ssh-directory-permissions.md (100%) rename src/posts/{data => 2021}/2021-reading-list.md (100%) rename src/posts/{data => 2021}/a-brief-intro-to-git.md (100%) rename src/posts/{data => 2021}/apple-music-a-tale-of-woe.md (100%) rename src/posts/{data => 2021}/digital-privacy-tools.md (100%) rename src/posts/{data => 2022}/2022-reading-list.md (100%) rename src/posts/{data => 2022}/apple-centric-digital-privacy-tools.md (100%) rename src/posts/{data => 2022}/apple-messages-a-tale-of-woe.md (100%) rename src/posts/{data => 2022}/automating-email-cleanup-in-gmail.md (100%) rename src/posts/{data => 2022}/fixing-safari-icloud-syncing.md (100%) rename src/posts/{data => 2022}/migrating-to-fastmail.md (100%) rename src/posts/{data => 2022}/simple-api-fetch-hooks-with-swr.md (100%) rename src/posts/{data => 2023}/adding-client-side-rendered-webmentions-to-my-blog.md (100%) rename src/posts/{data => 2023}/automating-and-overengineering-my-now-page.md (100%) rename src/posts/{data => 2023}/automating-rss-syndication-with-nextjs-github.md (100%) rename src/posts/{data => 2023}/building-a-now-page-using-nextjs-and-social-apis.md (100%) rename src/posts/{data => 2023}/client-side-webmentions-in-nextjs.md (100%) rename src/posts/{data => 2023}/fastmail-handling-inbound-email-with-regex-filters-now-with-chatgpt.md (100%) diff --git a/.cache/eleventy-fetch-1cce4ddcbc732998e95932ffce6c63 b/.cache/eleventy-fetch-1cce4ddcbc732998e95932ffce6c63 new file mode 100644 index 00000000..5db79b11 --- /dev/null +++ b/.cache/eleventy-fetch-1cce4ddcbc732998e95932ffce6c63 @@ -0,0 +1 @@ +[{"1cce4ddcbc732998e95932ffce6c63":"1"},{"cachedAt":1678644641025,"type":"2"},"json"] \ No newline at end of file diff --git a/.cache/eleventy-fetch-1cce4ddcbc732998e95932ffce6c63.json b/.cache/eleventy-fetch-1cce4ddcbc732998e95932ffce6c63.json new file mode 100644 index 00000000..34cf70cb --- /dev/null +++ b/.cache/eleventy-fetch-1cce4ddcbc732998e95932ffce6c63.json @@ -0,0 +1 @@ +{"recenttracks":{"track":[{"artist":{"mbid":"5c9dd772-a38f-4873-baa8-4b5d9dff3990","#text":"Spanish Love Songs"},"streamable":"0","image":[{"size":"small","#text":"https://lastfm.freetls.fastly.net/i/u/34s/48db6044c10d51dbff34962827c5b85e.jpg"},{"size":"medium","#text":"https://lastfm.freetls.fastly.net/i/u/64s/48db6044c10d51dbff34962827c5b85e.jpg"},{"size":"large","#text":"https://lastfm.freetls.fastly.net/i/u/174s/48db6044c10d51dbff34962827c5b85e.jpg"},{"size":"extralarge","#text":"https://lastfm.freetls.fastly.net/i/u/300x300/48db6044c10d51dbff34962827c5b85e.jpg"}],"mbid":"972061fb-948c-4b18-b1cf-00091e2853a3","album":{"mbid":"67d1bb36-938f-42c7-b8ba-f95272bee0fe","#text":"Schmaltz"},"name":"Bellyache","url":"https://www.last.fm/music/Spanish+Love+Songs/_/Bellyache","date":{"uts":"1678578138","#text":"11 Mar 2023, 23:42"}}],"@attr":{"user":"cdme_","totalPages":"51030","page":"1","perPage":"1","total":"51030"}}} \ No newline at end of file diff --git a/.cache/eleventy-fetch-8acdd9ef0f147dd2cc625c51fb3557 b/.cache/eleventy-fetch-8acdd9ef0f147dd2cc625c51fb3557 new file mode 100644 index 00000000..fa840ecd --- /dev/null +++ b/.cache/eleventy-fetch-8acdd9ef0f147dd2cc625c51fb3557 @@ -0,0 +1 @@ +[{"8acdd9ef0f147dd2cc625c51fb3557":"1"},{"cachedAt":1678640218532,"type":"2"},"json"] \ No newline at end of file diff --git a/.cache/eleventy-fetch-8acdd9ef0f147dd2cc625c51fb3557.json b/.cache/eleventy-fetch-8acdd9ef0f147dd2cc625c51fb3557.json new file mode 100644 index 00000000..a12c2f28 --- /dev/null +++ b/.cache/eleventy-fetch-8acdd9ef0f147dd2cc625c51fb3557.json @@ -0,0 +1 @@ +{"request":{"status_code":200,"success":true},"response":{"message":"Here are cory’s statuses.","statuses":[{"id":"63fc194dee073","address":"cory","created":"1677465933","relative_time":"1 week ago","emoji":"😰","content":"Last.fm wins the award for API that's the hardest to actually get a valid session out of.","external_url":"https://social.lol/users/cory/statuses/109934407443377303"},{"id":"63f7c4cdd446e","address":"cory","created":"1677182157","relative_time":"2 weeks ago","emoji":"πŸ€–","content":"Turns out a gist and the GitHub api work just fine for storing some cached JSON.","external_url":"https://social.lol/users/cory/statuses/109915809892664040"},{"id":"63f5a0b752d9a","address":"cory","created":"1677041847","relative_time":"2 weeks ago","emoji":"πŸ€¦β€β™‚οΈ","content":"It’s always caching and naming things.","external_url":"https://social.lol/users/cory/statuses/109906614500602049"},{"id":"63f1a0719e3d1","address":"cory","created":"1676779633","relative_time":"3 weeks ago","emoji":"πŸ•―οΈ","content":"Are we out, are we out, are we out of the woods? Are we in, are we in the clear yet? Good","external_url":"https://social.lol/users/cory/statuses/109889430068101718"},{"id":"63edbf3b4d14b","address":"cory","created":"1676525371","relative_time":"3 weeks ago","emoji":"πŸ€","content":"Really hoping the Lakers can keep playing like this on a more consistent basis.","external_url":"https://social.lol/users/cory/statuses/109872766731050716"},{"id":"63ec33d1cf020","address":"cory","created":"1676424145","relative_time":"3 weeks ago","emoji":"πŸ€–","content":"Making ChatGPT refine the regular expressions I use to filter mail in Fastmail.","external_url":null},{"id":"63e87c132fed4","address":"cory","created":"1676180499","relative_time":"4 weeks ago","emoji":"🏈","content":"Proactively updating my mute filters.","external_url":"https://social.lol/users/cory/statuses/109850165192877065"},{"id":"63e5c2d21e578","address":"cory","created":"1676002002","relative_time":"1 month ago","emoji":"πŸ₯Έ","content":"Slowly working towards making this backing next.js app for my omg.lol hosted things reusable.","external_url":"https://social.lol/users/cory/statuses/109838467208532403"},{"id":"63e1a34d1e713","address":"cory","created":"1675731789","relative_time":"1 month ago","emoji":"🫠","content":"Trying to automate RSS to Mastodon with a GitHub action.","external_url":"https://social.lol/users/cory/statuses/109820758529250058"},{"id":"63dc4e77e6b8e","address":"cory","created":"1675382391","relative_time":"1 month ago","emoji":"πŸ’»","content":"Tweaked and, perhaps, improved the styling on https://blog.coryd.dev","external_url":"https://social.lol/users/cory/statuses/109797860433025850"},{"id":"63da97b827939","address":"cory","created":"1675270072","relative_time":"1 month ago","emoji":"πŸ“Š","content":"Switched my site and blog over to Fathom https://usefathom.com/ref/EGXCON","external_url":"https://social.lol/users/cory/statuses/109790499446278723"},{"id":"63d3168c325b1","address":"cory","created":"1674778252","relative_time":"1 month ago","emoji":"πŸ’»","content":"yes I worked around the last.fm api not returning artist images for my /now page. Yes it was manual and yes it’s logging when one isn’t found. https://coryd.dev/now","external_url":null},{"id":"63c0c388150c5","address":"cory","created":"1673577352","relative_time":"1 month ago","emoji":"πŸ€–","content":"My faith in Apple's ability to associate concert photos with the correct artist has been shaken after they mislabeled a show by The National as a Blues Traveler concert.","external_url":null},{"id":"63be09e4ca887","address":"cory","created":"1673398756","relative_time":"1 month ago","emoji":"🀘🏻","content":"The first new death metal release of the year is a gnarly one https://rottedlife.bandcamp.com/album/gosudar-malignant-altar-split","external_url":null},{"id":"63bdb712f2fff","address":"cory","created":"1673377554","relative_time":"2 months ago","emoji":"πŸ€–","content":"Still tweaking things but it's a weblog lol https://cory.weblog.lol","external_url":null},{"id":"63b1cabbbc55b","address":"cory","created":"1672596155","relative_time":"2 months ago","emoji":"πŸ₯²","content":"Apparently I've been spending too much time with Ember and handlebars because I just went to fix something in a React project and started passing all the props through as objects.","external_url":null},{"id":"63b08f2e75625","address":"cory","created":"1672515374","relative_time":"2 months ago","emoji":"πŸ₯³","content":"Celebrating New Years Eve by going to sleep as soon as both kids do.","external_url":null}]}} \ No newline at end of file diff --git a/.eleventy.js b/.eleventy.js index d0e8c472..c9a94ab7 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -1,33 +1,41 @@ const syntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight') +const heroIcons = require('eleventy-plugin-heroicons') const markdownIt = require('markdown-it') const markdownItAnchor = require('markdown-it-anchor') const markdownItFootnote = require('markdown-it-footnote') const filters = require('./config/filters.js') +const dateFilters = require('./config/dateFilters.js') module.exports = function (eleventyConfig) { - // Plugins + // plugins eleventyConfig.addPlugin(syntaxHighlight) + eleventyConfig.addPlugin(heroIcons) // filters Object.keys(filters).forEach((filterName) => { eleventyConfig.addFilter(filterName, filters[filterName]) }) - // To enable merging of tags + // date filters + Object.keys(dateFilters).forEach((filterName) => { + eleventyConfig.addFilter(filterName, dateFilters[filterName]) + }) + + // enable merging of tags eleventyConfig.setDataDeepMerge(true) - // Copy these static files to _site folder + // copy these static files to _site folder eleventyConfig.addPassthroughCopy('src/assets') eleventyConfig.addPassthroughCopy('src/manifest.json') - // To create excerpts + // create excerpts eleventyConfig.setFrontMatterParsingOptions({ excerpt: true, excerpt_alias: 'post_excerpt', excerpt_separator: '', }) - // To create a filter to determine duration of post + // create a filter to determine duration of post eleventyConfig.addFilter('readTime', (value) => { const content = value const textOnly = content.replace(/(<([^>]+)>)/gi, '') @@ -35,7 +43,7 @@ module.exports = function (eleventyConfig) { return Math.max(1, Math.floor(textOnly.length / readingSpeedPerMin)) }) - // Enable us to iterate over all the tags, excluding posts and all + // enable us to iterate over all the tags, excluding posts and all eleventyConfig.addCollection('tagList', (collection) => { const tagsSet = new Set() collection.getAll().forEach((item) => { diff --git a/config/dateFilters.js b/config/dateFilters.js new file mode 100644 index 00000000..4b29c3d7 --- /dev/null +++ b/config/dateFilters.js @@ -0,0 +1,40 @@ +const { DateTime } = require('luxon') + +module.exports = { + dateForFeed: (date) => { + return new Date(date).toISOString() + }, + toDateTime: (date) => { + const formatted = DateTime.fromISO(date) + + const trail = (number) => { + return parseInt(number, 10) < 10 ? `0${number}` : number + } + + return `${formatted.year}-${trail(formatted.month)}-${trail(formatted.day)} ${trail( + formatted.hour + )}:${trail(formatted.minute)}` + }, + toDateTimeFromUnix: (date) => { + const formatted = DateTime.fromSeconds(parseInt(date, 10)) + + const trail = (number) => { + return parseInt(number, 10) < 10 ? `0${number}` : number + } + + return `${trail(formatted.month)}.${trail(formatted.day)}.${formatted.year} ${trail( + formatted.hour + )}:${trail(formatted.minute)}` + }, + isoDateOnly: (date) => { + let d = new Date(date) + let month = '' + (d.getMonth() + 1) + let day = '' + d.getDate() + let year = d.getFullYear() + + if (month.length < 2) month = '0' + month + if (day.length < 2) day = '0' + day + + return [year, month, day].join('-') + }, +} diff --git a/config/filters.js b/config/filters.js index cd12c47b..21e2e8cf 100644 --- a/config/filters.js +++ b/config/filters.js @@ -1,3 +1,4 @@ +const marked = require('marked') const sanitizeHTML = require('sanitize-html') module.exports = { @@ -11,6 +12,9 @@ module.exports = { stripIndex: (path) => { return path.replace('/index.html', '/') }, + mdToHtml: (content) => { + return marked.parse(content) + }, getFirstAttachment: (post) => { if (post && post.attachments && post.attachments.length > 0) { return post.attachments[0].url ? post.attachments[0].url : post.attachments[0] diff --git a/package.json b/package.json index 294099c1..b10a6966 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "@11ty/eleventy": "^2.0.0", "@11ty/eleventy-plugin-syntaxhighlight": "^4.2.0", "@fontsource/inter": "^4.5.15", + "eleventy-plugin-heroicons": "^1.1.0", "eslint": "^8.36.0", "eslint-config-prettier": "^8.7.0", "eslint-plugin-prettier": "^4.2.1", @@ -28,6 +29,7 @@ "vercel-submodules": "^1.0.10" }, "dependencies": { + "@11ty/eleventy-fetch": "^3.0.0", "@11ty/eleventy-img": "^3.0.0", "@tailwindcss/typography": "^0.5.1", "autoprefixer": "^10.4.2", @@ -35,6 +37,7 @@ "markdown-it": "^13.0.1", "markdown-it-anchor": "^8.4.1", "markdown-it-footnote": "^3.0.3", + "marked": "^4.2.12", "tailwind-dracula": "^1.1.0", "tailwindcss": "^3.0.18" } diff --git a/src/_data/nowplaying.js b/src/_data/nowplaying.js new file mode 100644 index 00000000..b7654b1f --- /dev/null +++ b/src/_data/nowplaying.js @@ -0,0 +1,15 @@ +const EleventyFetch = require('@11ty/eleventy-fetch') + +module.exports = async function () { + const url = 'https://coryd.dev/api/music?limit=1&period=7day' + const res = EleventyFetch(url, { + duration: '10m', + type: 'json', + }) + const music = await res + return { + artist: music.recenttracks.track[0].artist['#text'], + title: music.recenttracks.track[0].name, + url: music.recenttracks.track[0].url, + } +} diff --git a/src/_data/status.js b/src/_data/status.js new file mode 100644 index 00000000..5a520b78 --- /dev/null +++ b/src/_data/status.js @@ -0,0 +1,11 @@ +const EleventyFetch = require('@11ty/eleventy-fetch') + +module.exports = async function () { + const url = 'https://api.omg.lol/address/cory/statuses/' + const res = EleventyFetch(url, { + duration: '1d', + type: 'json', + }) + const status = await res + return status.response.statuses[0] +} diff --git a/src/_includes/now-topper.liquid b/src/_includes/now-topper.liquid new file mode 100644 index 00000000..2c0be2e3 --- /dev/null +++ b/src/_includes/now-topper.liquid @@ -0,0 +1,6 @@ +
+

Now

+

I'm a software developer in Camarillo, California. I enjoy hanging out with my beautiful family and 4 rescue dogs, technology, automation, music, writing, reading and tv and movies.

+

{{ status.emoji }} {{ status.content }}

+

{% heroicon "solid" "music-note" "Now playing" "width=20 height=20" %} {{nowplaying.title}} by {{nowplaying.artist}}

+
diff --git a/src/index.html b/src/index.html index 63f02f9a..f19fd6bf 100644 --- a/src/index.html +++ b/src/index.html @@ -9,8 +9,8 @@ pagination: templateEngineOverride: liquid,md --- -{% for post in pagination.items %} {% if post.data.published %} -
+{% include "now-topper.liquid" %} {% for post in pagination.items %} {% if post.data.published %} +