Skip to content

Instantly share code, notes, and snippets.

View jgarber623's full-sized avatar
:atom:

Jason Garber jgarber623

:atom:
View GitHub Profile
@jgarber623
jgarber623 / bookmarklet.html
Last active January 31, 2024 15:45
A bookmarklet that generates a QR Code of the current page's URL and displays it in a <dialog> element (assuming a Content Security Policy doesn't prevent the script from running). Inspired by https://til.therealadam.com/2024/01/31/sneakerneting-urls-to.html.
<a href="javascript:(()=>{const script=document.createElement('script');script.type='module';script.append(document.createTextNode=`import QRCode from 'https://cdn.jsdelivr.net/npm/qrcode@1.5.3/+esm';const dialog=document.createElement('dialog');const img=document.createElement('img');img.src=await QRCode.toDataURL(location.href);dialog.append(img);document.body.append(dialog);dialog.showModal();`);document.body.append(script)})()">Generate QR Code</a>
@jgarber623
jgarber623 / 01_zprofile
Created December 13, 2023 14:39
A minimal set of configuration to use an SSH key stored in 1Password with Git (and Dev Containers).
# ~/.zprofile
#
# Rather than follow 1Password's recommendation to configure this in ~/.ssh/config, override
# macOS' default SSH_AUTH_SOCK environment variable. In testing, this configuration allowed
# for Visual Studio Code's Dev Containers extension to reliably connect to the host machine's
# SSH agent.
#
# ~/.zprofile (or ~/.bash_profile) is the recommended location, but other files sourced
# by your shell _might_ work.
# Install Homebrew system dependencies
apt update && apt install --yes build-essential curl file git procps
# Install Homebrew
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Source Homebrew
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
# Install dotfiles dependencies
@jgarber623
jgarber623 / indieweb-micro-fiction-1.md
Last active February 6, 2023 04:19
Distributed, IndieWeb-friendly micro-fiction (pt. 1)

Distributed, IndieWeb-friendly micro-fiction (pt. 1)

Kevin’s website

Kevin wants to write a story on his website, https://kevin.example. His website supports receiving webmentions and he advertises this feature with this HTML in his website’s <head> element:

<link rel="webmention" href="https://kevin.example/webmention">
@jgarber623
jgarber623 / h-x-app.html
Created November 3, 2022 19:36
Documenting a few contrived examples for marking up minimal application author information using microformats2.
<div class="h-x-app">
<div class="p-author">Jason Garber</div>
</div>
<div class="h-x-app">
<div class="p-author h-card">Jason Garber</div>
</div>
<div class="h-x-app">
<a href="https://jgarber.example" class="u-author">Jason Garber</a>
@jgarber623
jgarber623 / Dockerfile
Last active January 27, 2023 15:01
A set of files that could serve as a starting point for a Docker-based Ruby on Rails application.
FROM debian:bullseye-slim
ARG NODE_VERSION="18.x"
ARG POSTGRESQL_VERSION="14"
ARG RAILS_VERSION=">= 7.0"
ARG REDIS_VERSION="7.0.5"
ARG RUBY_INSTALLER_VERSION="0.8.5"
ARG RUBY_VERSION="3.1.2"
ENV DEBIAN_FRONTEND=noninteractive
@jgarber623
jgarber623 / representative_h_card_parser.rb
Last active September 1, 2022 02:03
An example Ruby class implementing the microformats2 "representative h-card" parsing algorithm using MicroMicro.
# frozen_string_literal: true
class RepresentativeHCardParser
# @param document [MicroMicro::Document]
# @param canonical_url [String]
def initialize(document, canonical_url)
@document = document
@canonical_url = canonical_url
end
@jgarber623
jgarber623 / webmention-rocks.html
Last active May 20, 2022 01:06
webmention.rocks Test Suite URLs
<article class="h-entry">
<div class="e-content">
<p>This post is a reply to the <a href="https://webmention.rocks/test/1" class="u-in-reply-to">Test 1</a> page on webmention.rocks!</p>
</div>
<aside class="p-author h-card">
<a class="u-url" href="https://sixtwothree.org">
<img alt="Jason Garber" class="u-photo" src="https://assets.sixtwothree.org/jgarber.png">
</a>
</aside>
</article>
@jgarber623
jgarber623 / tiny-tiny-javascript.md
Created April 26, 2019 20:08
I maintain a growing collection of small, curiously-named JavaScript utilities.

This configuration works, but doesn't include any rule customization:

{
  "extends": [
    "web-recommended"
  ],
  "formatters": [
    "codeframe"
 ],