cleanup + now topper
This commit is contained in:
parent
6c81b89874
commit
82604bd42b
38 changed files with 123 additions and 8 deletions
1
.cache/eleventy-fetch-1cce4ddcbc732998e95932ffce6c63
Normal file
1
.cache/eleventy-fetch-1cce4ddcbc732998e95932ffce6c63
Normal file
|
@ -0,0 +1 @@
|
|||
[{"1cce4ddcbc732998e95932ffce6c63":"1"},{"cachedAt":1678644641025,"type":"2"},"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"}}}
|
1
.cache/eleventy-fetch-8acdd9ef0f147dd2cc625c51fb3557
Normal file
1
.cache/eleventy-fetch-8acdd9ef0f147dd2cc625c51fb3557
Normal file
|
@ -0,0 +1 @@
|
|||
[{"8acdd9ef0f147dd2cc625c51fb3557":"1"},{"cachedAt":1678640218532,"type":"2"},"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}]}}
|
20
.eleventy.js
20
.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: '<!-- excerpt -->',
|
||||
})
|
||||
|
||||
// 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) => {
|
||||
|
|
40
config/dateFilters.js
Normal file
40
config/dateFilters.js
Normal file
|
@ -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('-')
|
||||
},
|
||||
}
|
|
@ -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]
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
15
src/_data/nowplaying.js
Normal file
15
src/_data/nowplaying.js
Normal file
|
@ -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,
|
||||
}
|
||||
}
|
11
src/_data/status.js
Normal file
11
src/_data/status.js
Normal file
|
@ -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]
|
||||
}
|
6
src/_includes/now-topper.liquid
Normal file
6
src/_includes/now-topper.liquid
Normal file
|
@ -0,0 +1,6 @@
|
|||
<div class="border-b border-gray-200 pb-8 dark:border-gray-700 mb-8 pb-8 dark:text-white text-gray-800">
|
||||
<a class="no-underline" href="/"><h2 class="m-0 text-xl font-black leading-tight tracking-normal md:text-2xl text-primary-400 hover:text-primary-500 dark:hover:text-primary-300 mb-4">Now</h2></a>
|
||||
<p>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.</p>
|
||||
<p>{{ status.emoji }} {{ status.content }}</p>
|
||||
<p class="mb-0"><a class="no-underline dark:text-white text-gray-800 font-normal" href={{nowplaying.url}}><span class="icon-inline">{% heroicon "solid" "music-note" "Now playing" "width=20 height=20" %}</span> {{nowplaying.title}} by {{nowplaying.artist}}</a></p>
|
||||
</div>
|
|
@ -9,8 +9,8 @@ pagination:
|
|||
templateEngineOverride: liquid,md
|
||||
---
|
||||
|
||||
{% for post in pagination.items %} {% if post.data.published %}
|
||||
<div class="mb-8 border-b border-gray-200 pb-8 text-gray-800 dark:border-gray-700 dark:text-white">
|
||||
{% include "now-topper.liquid" %} {% for post in pagination.items %} {% if post.data.published %}
|
||||
<div class="mb-8 border-b border-gray-200 pb-4 text-gray-800 dark:border-gray-700 dark:text-white">
|
||||
<a class="no-underline" href="{{ post.url }}"
|
||||
><h2
|
||||
class="m-0 text-xl font-black leading-tight tracking-normal dark:text-gray-200 md:text-2xl"
|
||||
|
|
14
tailwind.css
14
tailwind.css
|
@ -2,6 +2,16 @@
|
|||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
|
||||
::-moz-selection {
|
||||
color: theme(colors.gray.800);
|
||||
background: theme(colors.purple.400);
|
||||
}
|
||||
|
||||
::selection {
|
||||
color: theme(colors.gray.800);
|
||||
background: theme(colors.purple.400);
|
||||
}
|
||||
|
||||
.paginator-text {
|
||||
@apply py-2 px-4 font-bold text-gray-600 dark:text-gray-200;
|
||||
}
|
||||
|
@ -25,3 +35,7 @@
|
|||
.dark .toggle-dark {
|
||||
@apply inline;
|
||||
}
|
||||
|
||||
.icon-inline svg {
|
||||
@apply inline;
|
||||
}
|
||||
|
|
10
yarn.lock
10
yarn.lock
|
@ -852,6 +852,11 @@ electron-to-chromium@^1.4.284:
|
|||
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.328.tgz#b4565ffa502542b561cea16086d6d9b916c7095a"
|
||||
integrity sha512-DE9tTy2PNmy1v55AZAO542ui+MLC2cvINMK4P2LXGsJdput/ThVG9t+QGecPuAZZSgC8XoI+Jh9M1OG9IoNSCw==
|
||||
|
||||
eleventy-plugin-heroicons@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/eleventy-plugin-heroicons/-/eleventy-plugin-heroicons-1.1.0.tgz#5799b37251269e9d3b46c27185f724d319f4b28b"
|
||||
integrity sha512-i9pBWru64ixs8lafSPFLsiCdcpy/FvRb0G/sS5D+VuS+QKyJE5ifxsGtOi6AiAdTzHp1t6uXV4ZMb0k5ACrgng==
|
||||
|
||||
eleventy-rss-helper@^1.2.1:
|
||||
version "1.2.1"
|
||||
resolved "https://registry.yarnpkg.com/eleventy-rss-helper/-/eleventy-rss-helper-1.2.1.tgz#c5a1e06bb94687f2df542adede67bbacb54f5daa"
|
||||
|
@ -1724,6 +1729,11 @@ markdown-it@^13.0.1:
|
|||
mdurl "^1.0.1"
|
||||
uc.micro "^1.0.5"
|
||||
|
||||
marked@^4.2.12:
|
||||
version "4.2.12"
|
||||
resolved "https://registry.yarnpkg.com/marked/-/marked-4.2.12.tgz#d69a64e21d71b06250da995dcd065c11083bebb5"
|
||||
integrity sha512-yr8hSKa3Fv4D3jdZmtMMPghgVt6TWbk86WQaWhDloQjRSQhMMYCAro7jP7VDJrjjdV8pxVxMssXS8B8Y5DZ5aw==
|
||||
|
||||
maximatch@^0.1.0:
|
||||
version "0.1.0"
|
||||
resolved "https://registry.yarnpkg.com/maximatch/-/maximatch-0.1.0.tgz#86cd8d6b04c9f307c05a6b9419906d0360fb13a2"
|
||||
|
|
Reference in a new issue