Skip to content

Latest πŸ—žοΈ

Friday, March 20

Firebase Quotas and Cloudflare Workers

I’m currently enrolled in the MIT xPRO Professional Certificate in Coding program. In a recent assignment, we β€œdelved” (as the course materials would put it) into GitHub Actions by setting up an automated testing and deployment workflow for a simple Express.js app. See the README on GitHub for my full report.

The deployment component was supposed to happen on Firebase, but I had already reached my project quota due to an earlier batch of assignments. After digging, I found information suggesting that my quota would reset 30 days after deleting the old projects, but the actual error message just said to contact support to request an increase. I received a prompt response (but to my Gmail account, of course, so I didn’t see it for a few days):

View full post…

Git Commits

days commits 9 ohnsh/days
  • 5:09 pm β€” John Sherrell <dev@ohn.sh>

    Clean up loaders/github.ts

  • 4:55 pm β€” John Sherrell <dev@ohn.sh>

    Reverse-chronological sort for days listed under /tags/[tag].

  • 3:09 pm β€” John Sherrell <dev@ohn.sh>

    Merge branch 'pure-loaders'

  • 3:08 pm β€” John Sherrell <dev@ohn.sh>

    Now sorting commits, but the technique is a little ugly. I'm considering guaranteeing a sort order for various arrays when Day object is initialized.

  • 3:01 pm β€” John Sherrell <dev@ohn.sh>

    Daily commits now rendering again. Refactor seemingly complete. Need to get commits sorted on page.

  • 1:27 pm β€” John Sherrell <dev@ohn.sh>

    3/19 metadata.

  • 1:20 pm β€” John Sherrell <dev@ohn.sh>

    loaders/github.ts now exports two loaders: repoLoader() and commitLoader(). There will be a collection for each. Getting to the meat of this refactor in the <GithubDay> and <RepoDay> components.

  • 12:43 pm β€” John Sherrell <dev@ohn.sh>

    Improve schemas/typing in youtube loader. No longer manually creating API schema. Presently, types are inferred when importing the intermediate .json file. When fetching directly, I need to use a schema provided by the API to generate a zod schema and/or typescript type.

  • 12:24 pm β€” John Sherrell <dev@ohn.sh>

    YouTube collection rendering again. Simplified loader creates a 'pure' collection of videos keyed by videoid. It also computes the day (using video title and pubDate) and stores it in each entry. Actual sorting of entries into days happens elsewhere, as it should.

xpro-nextjs-dashboard commits 1 ohnsh/xpro-nextjs-dashboard
  • 8:40 pm β€” John Sherrell <dev@ohn.sh>

    Initial commit from Create Next App

YouTube

Play

It’s spring, betches

Thursday, March 19

tags:

Git Commits

days commits 3 ohnsh/days
  • 5:48 pm β€” John Sherrell <dev@ohn.sh>

    Building again. Still lots to do.

  • 1:56 pm β€” John Sherrell <dev@ohn.sh>

    lib/dates.ts finally doesn't make me wince. Thoroughly renamed and refactored. Instead of expecting only plain dates, `dayFromDate()` and `slugFromDate()` work with either full timestamps (which are fine to implicitly convert to local time) or plain dates (which are important to represent the way they were originally typed out). You explicitly specify whether it's a `plainDate` using a second parameter (default false). If so, it's normalized to midnight UTC so that later string extraction knows to always use UTC getters.

  • 4:55 am β€” John Sherrell <dev@ohn.sh>

    New branch for reworking loaders. Everything is broken right now.

ra24-3-cloudflare commits 1 ohnsh/ra24-3-cloudflare
  • 12:28 am β€” John Sherrell <dev@ohn.sh>

    README.md CE.

YouTube

Wednesday, March 18

Git Commits

ra24-3-cloudflare commits 11 ohnsh/ra24-3-cloudflare
  • 10:38 pm β€” John Sherrell <107401967+ohnsh@users.noreply.github.com>

    Formatting

  • 10:36 pm β€” John Sherrell <107401967+ohnsh@users.noreply.github.com>

    Add screenshots for report. Assignment calls for PDF with screenshots. (Yes, really.)

  • 10:18 pm β€” John Sherrell <dev@ohn.sh>

    Report CE.

  • 10:01 pm β€” John Sherrell <dev@ohn.sh>

    Report finished.

  • 8:17 pm β€” John Sherrell <dev@ohn.sh>

    Report checkpoint.

  • 7:59 pm β€” John Sherrell <dev@ohn.sh>

    Starting report.

  • 7:17 pm β€” John Sherrell <dev@ohn.sh>

    Bump wrangler used in workflow. I think the older version isn't picking up wrangler.jsonc.

  • 7:10 pm β€” John Sherrell <dev@ohn.sh>

    Install bun before running deploy step.

  • 7:08 pm β€” John Sherrell <dev@ohn.sh>

    Added cloudflare deploy-on-push configuration to github workflow.

  • 6:57 pm β€” John Sherrell <dev@ohn.sh>

    Trying RA 24.3 using Cloudflare Workers due to reaching project quota on Firebase.

  • 5:29 pm β€” John Sherrell <dev@ohn.sh>

    Initial commit (by create-cloudflare CLI) Details: C3 = create-cloudflare@2.64.9 project name = ra24-3-cloudflare package manager = bun@1.3.9 wrangler = wrangler@4.75.0 git = 2.53.0

days commits 3 ohnsh/days
  • 4:55 pm β€” John Sherrell <dev@ohn.sh>

    Added tags to sidebar, rudimentary tag-index page. It's a little ugly right now but I expect to refactor everything thoroughly over time.

  • 3:38 pm β€” John Sherrell <dev@ohn.sh>

    I kind of hate what I've done here, but it's an intermediate step toward a full-featured tag implementation. Tags are now mapped to dayKeys, and dayEntries have their own aggregate tagMaps (map of Tag -> CollectionEntry[] where each entry could be a video, commit, day metadata, etc.) First, I need to rework collections to make them consistent. In particular, Youtube and Github collections should be keyed by videoid and commit id/SHA, respectively, instead of being already collated into lists keyed by date.

  • 3:37 pm β€” John Sherrell <dev@ohn.sh>

    Remove test tags, empty day metadata. Update README.

Tuesday, March 17

tags:

Git Commits

mit-xpro-ra24-3 commits 2 ohnsh/mit-xpro-ra24-3
  • 11:38 pm β€” John Sherrell <dev@ohn.sh>

    Added Github workflow that runs `bun test` on push.

  • 11:27 pm β€” John Sherrell <dev@ohn.sh>

    Testing a hello whirled express app with Jest-compatible `bun test`. This is part of an assignment in which testing and deployment will be automated with GitHub Actions and Firebase.

days commits 3 ohnsh/days
  • 1:24 am β€” John Sherrell <dev@ohn.sh>

    Static screenshot og:image option. Looking into ways to automate this.

  • 12:51 am β€” John Sherrell <dev@ohn.sh>

    Edits.

  • 12:49 am β€” John Sherrell <dev@ohn.sh>

    Make hero more screenshot-friendly at small viewport sizes. I didn't want to override the `clamp()` expression completely, so instead I hijacked --sl-text-base and --sl-text-3xl (scope limited to the hero) which are used in those expressions.

ra24-2_github-actions commits 1 ohnsh/ra24-2_github-actions
  • 4:21 pm β€” John Sherrell <dev@ohn.sh>

    Demo workflow from Github docs.

Monday, March 16

j.ohn.sh back in business.

My link page at https://j.ohn.sh had been neglected for a few years, so I decided to rebuild it on Astro, the same framework I’m using here at days.ohn.sh. The old repository is still on GitHub.

Back when I made the original, I wouldn’t have been caught dead using a framework. In other, more complicated projects, I built static HTML using Makefiles and esh templates, but this one was a simple index.html with no build tool.

View full post…

Git Commits

ohnsh.github.io commits 2 ohnsh/ohnsh.github.io
  • 6:08 pm β€” John Sherrell <107401967+ohnsh@users.noreply.github.com>

    Revise links in README for new and archived pages

  • 1:42 am β€” John Sherrell <107401967+ohnsh@users.noreply.github.com>

    Switching repos for personal link page; not using Github Pages.

itsa-me commits 12 ohnsh/itsa-me
  • 5:49 pm β€” John Sherrell <107401967+ohnsh@users.noreply.github.com>

    Fix header formatting in README

  • 5:48 pm β€” John Sherrell <107401967+ohnsh@users.noreply.github.com>

    Replace generated README.

  • 5:15 pm β€” John Sherrell <dev@ohn.sh>

    Officially tired of my profile pic. For now, I'm using my 2023-era glamour shot. I tried using Astro's <Image> and asset optimization, but the quality was pretty bad. Letting the browser resize from 1280px down to 200px seems wasteful, but the result speaks for itself.

  • 4:54 pm β€” John Sherrell <dev@ohn.sh>

    Get back some width by moving `min-width` back to the inner element (ul). Document the magic numbers used for column alignment.

  • 4:38 pm β€” John Sherrell <dev@ohn.sh>

    Hue rotated towards chocolate.

  • 4:16 pm β€” John Sherrell <dev@ohn.sh>

    Get some hover action back. Not sure yet if I'm goint to do `background-clip: text` to get a gradient over the text like on the original version.

  • 3:47 pm β€” John Sherrell <dev@ohn.sh>

    Move custom domain config into wrangler.jsonc

  • 3:44 pm β€” John Sherrell <dev@ohn.sh>

    Stroke widths normalized. Good enough to merge and deploy.

  • 3:37 pm β€” John Sherrell <dev@ohn.sh>

    Refactor isn't quite right yet, but it'll do for now. Still need to get stroke-widths normalized. (They seem to be relative to the size of the viewbox, which unfortunately varies between icons and is tightly coupled to the internal path definitions.)

  • 2:58 pm β€” John Sherrell <dev@ohn.sh>

    Re-factoring has cleaned things up quite a bit, but there are a few style regressions.

  • 2:25 pm β€” John Sherrell <dev@ohn.sh>

    Overhaul icons, set colors back to the classic scheme. Need to factor out a component or two.

  • 1:30 am β€” John Sherrell <dev@ohn.sh>

    Removing PicoCSS; basically a reboot.

days commits 4 ohnsh/days
  • 10:44 pm β€” John Sherrell <dev@ohn.sh>

    Finished up post.

  • 6:55 pm β€” John Sherrell <dev@ohn.sh>

    Added spacing between sub-articles (top-level sections within each day). Started a new post about the new (and old) version of my link page.

  • 1:02 am β€” John Sherrell <dev@ohn.sh>

    Tweak commit count badges. Now inline-block with a min-width.

  • 12:45 am β€” John Sherrell <dev@ohn.sh>

    Gradually getting out of the business of customizing the theme. The higher contrast looks better suddenly and makes more of the --sl-color-gray-* shades useful.

scratch commits 1 ohnsh/scratch
  • 5:51 pm β€” John Sherrell <107401967+ohnsh@users.noreply.github.com>

    Add initial README

Sunday, March 15

Git Commits

days commits 10 ohnsh/days
  • 11:57 pm β€” John Sherrell <dev@ohn.sh>

    Tweak post header styles, remove console.log.

  • 11:04 pm β€” John Sherrell <dev@ohn.sh>

    Styles: using border-bottom on post titles instead of <hr />. The border is actually on a new <header> wrapping both the h2 and tags. On single-day pages, the rules are a bit different: Tags need a negative margin to create a superficial grouping with the h1 rendered by <StarlightPage>.

  • 10:08 pm β€” John Sherrell <dev@ohn.sh>

    Github loader: New, generalized fetch-all-pages abstraction around api() calls. Just in time for my 99th commit. The Github API uses the HTTP `Link` header to return next-page URLs, while the YouTube API puts them in the body.

  • 9:26 pm β€” John Sherrell <dev@ohn.sh>

    Youtube loader: Generalized fetch-all-pages abstraction around YouTube Data API calls.

  • 9:03 pm β€” John Sherrell <dev@ohn.sh>

    Edited site description.

  • 8:47 pm β€” John Sherrell <dev@ohn.sh>

    Reaching into tab component styles to remove full-width border. This UI needs a lot of improvement, possibly in the form of a framework component, but for now it's better than using <details> everywhere.

  • 12:34 pm β€” John Sherrell <dev@ohn.sh>

    Updated og:image extraction to extract multiple thumbnails if available. (E.g. Facebook lets you pick between them when posting.) Currently filtering out timelapse videos and prioritizing running videos.

  • 12:00 pm β€” John Sherrell <dev@ohn.sh>

    Can't pass empty string in <TabItem> label prop.

  • 11:54 am β€” John Sherrell <dev@ohn.sh>

    Changed YouTube daily entries (<YTDay>) to tabbed interface. Using starlight/astro <Tabs> component but considering adding React to this project and testing radix-ui.

  • 1:47 am β€” John Sherrell <dev@ohn.sh>

    Now grouping videos by tag for display. New <VideoList> component for that purpose. Upgrades to emoji detection. A sort order for tags can be passed as a prop.

Saturday, March 14

Git Commits

days commits 5 ohnsh/days
  • 11:54 pm β€” John Sherrell <dev@ohn.sh>

    Added automatic tag extraction (based on emoji) to youtube loader. Using `Intl.Segmenter` API to handle complex multi-codepoint emoji. Also fixed some edge cases when parsing dates from video titles with implicit years. The year is taken from the pub date but adjusted as necessary in case the two dates fall on different sides of a December/January boundary.

  • 9:24 pm β€” John Sherrell <dev@ohn.sh>

    Youtube loader: fix regex date-from-title parsing edge cases. (JavaScript will parse 'Run 1' as a valid date: January 1, 2001. JavaScript is always right.)

  • 3:57 pm β€” John Sherrell <dev@ohn.sh>

    Dynamic heading levels for rendered markdown and mdx. My spidey sense said that heading levels were going to be a huge pain, and they were. I settled on something that seems pretty robust but unfortunately involves regex string replacement on raw HTML. The <Post> component (similar to the previous <Preview>) computes a heading level offset based on context (list of posts versus single post). Then, a <PostWrapper> component is passed the actual <Content /> in a slot and uses `Astro.slots.render('default')` to obtain the rendered HTML string, which it then manipulates and renders to the page with `<Fragment set:html={adjustedHtml} />`.

  • 12:16 pm β€” John Sherrell <dev@ohn.sh>

    Added horizontal rules back in, moved the CSS to global.css.

  • 1:31 am β€” John Sherrell <dev@ohn.sh>

    Paginated /tags/[tag] route. As a bonus, og:image now works on tag pages. Both og:image and pagination links are implemented in route middleware, so any paginated routes get them for free. Realized that using [...page].astro instead of [page].astro allows for more elegant routes: the first page has no page segment (the `page` parameter is undefined) so there's no need for an index page returning `Astro.rewrite('/route/1')`. So now I'm using it on both paginated routes: /tags/[tag] and /latest.

Friday, March 13

Posts are back.

Posts are now a distinct content collection. If you’re seeing this, they are being merged with other content types at build time to generate daily entries. Currently, both days and individual posts can be tagged. Posts are tagged in Markdown frontmatter while days are tagged in a separate YAML metadata collection.

View full post…

Git Commits

days commits 17 ohnsh/days
  • 11:04 pm β€” John Sherrell <dev@ohn.sh>

    Moved day tags to top, right under title. No longer rendering year in title for posts later than this month last year.

  • 10:09 pm β€” John Sherrell <dev@ohn.sh>

    Fixed sidebar month-rendering bug related to JavaScript date parsing (i.e. plain dates are usually interpreted as midnight local time, but sometimes as midnight UTC, creating weird day/month/year boundary issues.)

  • 9:34 pm β€” John Sherrell <dev@ohn.sh>

    Changed tagMap values to Set<DayEntry> instead of DayEntry[] to avoid duplicates. (For example, I had both today and a post from today tagged "test" which caused the day to render twice at tags/test.) Also switched on title rendering for days on tags route.

  • 9:23 pm β€” John Sherrell <dev@ohn.sh>

    Sidebar now working on tags routes.

  • 9:17 pm β€” John Sherrell <dev@ohn.sh>

    Tag route is in decent shape now except the sidebar. Lots of refactoring and cleanup in src/lib. De-duplicating filtering and sidebar processing in components by moving it to lib/day.ts and lib/sidebar.ts. Learned to be very careful abou what I import in astro.config.mjs (created lib/const.ts with no side effects or dependencies for this purpose).

  • 6:10 pm β€” John Sherrell <dev@ohn.sh>

    Day tags and post tags now being rendered. It's confusing when they're adjacent--I'll need to think that through. The /tags route is mostly working without me even touching it. There are a few things to fix up, especially the sidebar.

  • 5:59 pm β€” John Sherrell <dev@ohn.sh>

    Posts now rendering. Overall intra-day layout needs a lot of work, but the content is mostly there. Still need to merge in tagging/metadata from yaml collection. Also need to get og:image working again.

  • 5:28 pm β€” John Sherrell <dev@ohn.sh>

    Prepping posts to be merged into daily feed.

  • 4:51 pm β€” John Sherrell <dev@ohn.sh>

    Fixed sidebar regression where the header and footer was lost when I started dynamically generating the content. Now the static config is a template with a literal '<slot />' item that is replaced dynamically with the generated entries.

  • 2:26 pm β€” John Sherrell <dev@ohn.sh>

    Add wrangler to gitignore.

  • 2:22 pm β€” John Sherrell <dev@ohn.sh>

    Merge branch 'virtual-days'

  • 2:18 pm β€” John Sherrell <dev@ohn.sh>

    Titles fixed, filtering implemented (year >= 2025 for now).

  • 1:45 pm β€” John Sherrell <dev@ohn.sh>

    Getting close. All routes rendering, pagination working. Still need to render actual post content, fix up titles, filter days, and get og:image extraction working again.

  • 2:44 am β€” John Sherrell <dev@ohn.sh>

    Refactoring new code.

  • 2:23 am β€” John Sherrell <dev@ohn.sh>

    Auto-collapse all but first year and month.

  • 2:00 am β€” John Sherrell <dev@ohn.sh>

    Proof of concept. It works. Needs lots of work, though.

  • 12:17 am β€” John Sherrell <dev@ohn.sh>

    Getting there.

Thursday, March 12

Git Commits

days commits 4 ohnsh/days
  • 3:39 pm β€” John Sherrell <dev@ohn.sh>

    Nuke content folder, keeping actual posts for a "posts" collection. There's still a docs collection since this is starlight, but it might be empty. The days collection will be optional yaml metadata to for tagging and configuration.

  • 2:05 pm β€” John Sherrell <dev@ohn.sh>

    Updated github loader to fetch 100 commits per page. Still need to implement actual paging.

  • 12:58 pm β€” John Sherrell <dev@ohn.sh>

    Rough first pass of virtual day route.

  • 12:55 pm β€” John Sherrell <dev@ohn.sh>

    Prepping for new branch that will make major changes to project structure. Days will be virtual resources rather than concrete mdx files. The `days` collection will be strictly for metadata; posts will be a separate content collection, and they, along with github, youtube, etc., will be merged at the endpoint for a given day.

scratch commits 1 ohnsh/scratch
  • 12:51 pm β€” John Sherrell <dev@ohn.sh>

    remove note.

Wednesday, March 11

Git Commits

days commits 13 ohnsh/days
  • 10:17 pm β€” John Sherrell <dev@ohn.sh>

    Badge commit summaries with daily count.

  • 9:49 pm β€” John Sherrell <dev@ohn.sh>

    Bump Astro and Starlight.

  • 9:43 pm β€” John Sherrell <dev@ohn.sh>

    Wrap <YouTube> in <figure>; scoped CSS should make my custom Vite plugin obsolete.

  • 9:23 pm β€” John Sherrell <dev@ohn.sh>

    YouTube loader now detects when videos are shorts. <YTDay> now allows sorting by first character of video titles (for video titles with an emoji indicating subject/category).

  • 6:40 pm β€” John Sherrell <dev@ohn.sh>

    Added YouTube Data API loader; now videos are available in a day-oriented content collection, just like GitHub commits.

  • 1:29 pm β€” John Sherrell <dev@ohn.sh>

    Bring in loaders/github improvements from scratch. Commits now organized by local day instead of UTC.

  • 1:27 pm β€” John Sherrell <dev@ohn.sh>

    Refactor <GithubDay> and improve formatting. Now <Commit> and <RepoDay> are separate components.

  • 11:30 am β€” John Sherrell <dev@ohn.sh>

    Upgrade to Astro v6.

  • 2:59 am β€” John Sherrell <dev@ohn.sh>

    Added link-button out to repositories in <GithubDay>.

  • 1:56 am β€” John Sherrell <dev@ohn.sh>

    <GithubDay> commit formatting is less terrible. Still need to account for UTC timestamps and bring in a ~7-digit SHA prefix a la GitHub.

  • 1:28 am β€” John Sherrell <dev@ohn.sh>

    Add github sync script to package.json. March 11.

  • 1:03 am β€” John Sherrell <dev@ohn.sh>

    Clean up console.logs

  • 12:24 am β€” John Sherrell <dev@ohn.sh>

    Tagging implementation, loosely based on HiDeoo/starlight-blog. No pagination yet, but it will be necessary. Need to work on consistent conversion of tags to slugs. The <Tags> component has made me realize that the other everyday components like <YouTube> and <GithubDay> need to be rendered outside of the MDX where they can be passed computed props directly. This avoids a lot of duplication.

scratch commits 6 ohnsh/scratch
  • 9:50 pm β€” John Sherrell <dev@ohn.sh>

    YouTube loader now detects when videos are shorts. <YTDay> now allows sorting by first character of video titles (for video titles with an emoji indicating subject/category). Wrap <YouTube> in <figure>; allows for scoped CSS to override <lite-youtube> styles.

  • 6:22 pm β€” John Sherrell <dev@ohn.sh>

    Extracted a new content loader from YouTube Data API experiment. Loads videos keyed by day, as with the GitHub loader. Dates in the video title take precedence.

  • 1:12 pm β€” John Sherrell <dev@ohn.sh>

    Bring over GithubDays updates from days and refactor. Now <Commit> and <RepoDay> are separate components.

  • 12:29 pm β€” John Sherrell <dev@ohn.sh>

    Update color scheme cyan -> blue.

  • 12:24 pm β€” John Sherrell <dev@ohn.sh>

    more updates after nuking bun.lock.

  • 11:41 am β€” John Sherrell <dev@ohn.sh>

    Upgrade Astro to v6.