Skip to content

Instantly share code, notes, and snippets.

View ericclemmons's full-sized avatar
🏠
Working from home

Eric Clemmons ericclemmons

🏠
Working from home
View GitHub Profile
// @ts-check
/**
* Run `tsc` and pipe output to this script. All errors will write a `@ts-expect-error` comment into the source.
*
* Usage:
*
* tsc --noEmit --project ... | ./ts-expect-error.js
*
* Example (from the monorepo root):
@ericclemmons
ericclemmons / codegen.ts
Created April 22, 2024 04:41
graphql-codgen config for the best fully-typed, client-side GraphQL experience with TypeScript
import type {CodegenConfig} from '@graphql-codegen/cli';
const config: CodegenConfig = {
config: {
namingConvention: {
// Ensure enum values are the same as their name, not a number or camelCased
enumValues: 'keep',
},
},
schema: ['src/**/schema.graphql'],
# https://github.com/dependabot/fetch-metadata#enabling-auto-merge
name: Auto-merge Dependabot
on: pull_request_target
permissions:
pull-requests: write
contents: write
jobs:
@ericclemmons
ericclemmons / [[...slugs]].tsx
Created July 12, 2021 16:14
Non-FB-scale MDX with shared layout/nav
import Layout from "@/components/Layout";
import { getContentPaths } from "@/utils/getContentPaths";
import { getPageFromSlug } from "@/utils/getPageFromSlug";
import { GetStaticProps } from "next";
import dynamic from "next/dynamic";
import { renderToStaticMarkup } from "react-dom/server";
export default function ContentPage({ __html, frontmatter, pages, slug }) {
const Content = dynamic(() => import(`../content/${slug}/index.mdx`), {
loading() {
@ericclemmons
ericclemmons / machine.js
Last active March 13, 2020 01:47
Generated by XState Viz: https://xstate.js.org/viz
// This state machine is trying to figure out how to allow a user to call `await Auth.getUser()` multiple times throughout their app and get the current user once it resolves.
// Utility to resolve a Promise externally
const defer = () => {
let res,rej;
const promise = new Promise((resolve, reject) => {
res = resolve;
rej = reject;
@ericclemmons
ericclemmons / responsive-badge.html
Created May 28, 2019 04:14
Responsive indicators for TailwindCSS
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/tailwind.min.css">
<!-- Responsive indicators! -->
<div class="fixed top-0 right-0 z-50 bg-pink-500 text-white shadow-md px-2 rounded-bl font-mono">
<span class="sm:hidden">default</span>
<span class="hidden sm:inline md:hidden">sm</span>
<span class="hidden md:inline lg:hidden">md</span>
<span class="hidden lg:inline xl:hidden">lg</span>
<span class="hidden xl:inline">xl</span>
</div>
@ericclemmons
ericclemmons / README.md
Created April 15, 2018 23:36
Hot take on Zach Silveira's Gutenblock Demo!
@ericclemmons
ericclemmons / webpack.config.js
Created November 22, 2016 02:55
Minimal webpack + babel + Node v6 + Chrome
var webpack = require("webpack");
module.exports = {
module: {
loaders: [
{
exclude: /node_modules/,
loader: "babel-loader",
query: {
cacheDirectory: true,
@ericclemmons
ericclemmons / snazzy.itermcolors
Created September 17, 2016 03:18
Port of hyperterm-snazzy to iTerm2
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.15977835655212402</real>
@ericclemmons
ericclemmons / example.md
Last active September 20, 2024 12:46
HTML5 <details> in GitHub

Using <details> in GitHub

Suppose you're opening an issue and there's a lot noisey logs that may be useful.

Rather than wrecking readability, wrap it in a <details> tag!

<details>
 Summary Goes Here