Skip to content

Instantly share code, notes, and snippets.

View caseywatts's full-sized avatar
Hi, I’m Casey!

Casey Watts caseywatts

Hi, I’m Casey!
View GitHub Profile
@caseywatts
caseywatts / README.md
Last active April 7, 2025 16:41
MJML Template for USWDS

This is a proof of concept, re-creating USWDS styles in MJML.

Why?

Email clients don't render everything the same way as web browsers -- for example, <button> element is not supported in email clients. There are many workarounds to get buttons to work in many email clients, each with pros and cons.

How?

Tools like MJML help make this easier, by providing an abstraction layer over the complex markup we need to ensure cross-email-client compatibility.

@caseywatts
caseywatts / color-scale-generation.js
Last active March 13, 2025 21:27
Maryland Color Scale Generation
// note: this is using OKLCH, see https://oklch.com/
// https://evilmartians.com/chronicles/oklch-in-css-why-quit-rgb-hsl
import Color from "colorjs.io";
let marylandRedBase = new Color("oklch(52.44% 0.2043 17)");
let marylandAntiRedBase = new Color("oklch(52.44% 0.2043 197)");
let marylandGoldBase = new Color("oklch(84.63% 0.1611 83.87)");
let marylandAntiGoldBase = new Color("lch(65.14% 57.88 274.65)");
let marylandBlueBase = new Color("oklch(68.06% 0.173 281.52)");
@caseywatts
caseywatts / Web Component Before After Example.html
Last active October 24, 2024 17:13
Web Component Before/After Example
<!-- Before -->
<div class="usa-site-alert usa-site-alert--emergency">
<div class="usa-alert">
<div class="usa-alert__body">
<h4 class="usa-alert__heading">Emergency Status</h4>
<p class="usa-alert__text"> Lorem ipsum dolor sit amet, <a href="#">consectetur adipiscing</a> elit, sed do eiusmod. </p>
</div>
</div>
</div>
@caseywatts
caseywatts / README.md
Last active November 5, 2024 19:19
Astro + Tailwind + Lit Quick Setup
  1. Install Astro pnpm create astro@latest
  2. Install Tailwind pnpm astro add tailwind docs
  3. Install a UI Framework (lit, svelte, etc) pnpm astro add lit docs
  4. Install the Astro MDX Integration pnpm add @astrojs/mdx and pnpm astro add mdx docs
  5. Install the Sitemap addon pnpm astro add sitemap docs
  6. Push to new github repository gh repo create --push --public --source=.
@caseywatts
caseywatts / Download-Slack-Profile-Pictures.js
Last active May 2, 2024 06:04 — forked from jonkwheeler/Download-Slack-Profile-Pictures.js
Download Slack Profile Pictures / Images
// 1. Navigate to the Members View
// Enter slack in the browser. https://{insert your team name here}.slack.com/messages/
// Click on the channel you want.
// Click the information icon.
// Expand the members dropdown.
// Click "See All Members"
// 2. Run JS Code To Start
// Copy-paste this whole thing
@caseywatts
caseywatts / gist:653c762abe1cada63d56f66924f3c794
Last active May 2, 2024 06:04
Using Faker in the Node.js REPL

I learned how to open a module in a Node REPL thanks to this StackOverflow post

How to use Faker in a Node.js REPL

  1. npm install --save-dev "@faker-js/faker
    • = install Faker to your repository
    • (I made an empty project folder because idk how to find -g global ones in node)
  2. node --experimental-repl-await
    • = open the Node REPL with the experimental await feature
  3. let { faker } = await import('@faker-js/faker')
@caseywatts
caseywatts / tweet-the-toot.js
Last active May 2, 2024 06:05
Toot to Twitter Bookmarklet
javascript: (function () {
const tootContents = encodeURIComponent(
document
.getElementsByClassName("detailed-status")[0]
.getElementsByClassName("status__content__text")[0].innerText
);
const twitterLink = `https://twitter.com/intent/tweet?text=${tootContents}`;
window.location.href = twitterLink;
})();
@caseywatts
caseywatts / README.md
Last active April 4, 2023 20:23
Quick Links to DMs

So many messaging apps!! It's hard to keep track of who I talk to where!

I message Brian on Signal, Sean on Discord, and Steve by sms.

I just want to type their name and BAM immediately be in the correct app.

This takes two steps:

  1. Coming up with the "weird links" to open the right app to the right person (I use a spreadsheet)
  2. Making those "weird links" easy to open (like with Apple Shortcuts)
a = `10
13
10
9
14
10`
b = a.split("\n")
c = b.map(a => Number(a))
d = c.sort((a, b) => b-a)