Skip to content

Instantly share code, notes, and snippets.

View hamlim's full-sized avatar
💻
Working on side projects

Matt Hamlin hamlim

💻
Working on side projects
View GitHub Profile
@bizarre
bizarre / @vanilla-extract+next-plugin+2.1.1.patch
Last active March 25, 2023 23:53
NextJS 13 app dir + vanilla extract patches
diff --git a/node_modules/@vanilla-extract/next-plugin/dist/vanilla-extract-next-plugin.cjs.dev.js b/node_modules/@vanilla-extract/next-plugin/dist/vanilla-extract-next-plugin.cjs.dev.js
index 09e1996..fc27553 100644
--- a/node_modules/@vanilla-extract/next-plugin/dist/vanilla-extract-next-plugin.cjs.dev.js
+++ b/node_modules/@vanilla-extract/next-plugin/dist/vanilla-extract-next-plugin.cjs.dev.js
@@ -43,7 +43,8 @@ const createVanillaExtractPlugin = (pluginOptions = {}) => (nextConfig = {}) =>
isServer,
isDevelopment: dev,
future: nextConfig.future || {},
- experimental: nextConfig.experimental || {}
+ experimental: nextConfig.experimental || {},
class ListNode {
constructor(val = 0, next = null) {
this.value = val;
this.next = next;
}
}
let listA = new ListNode(2, new ListNode(4, new ListNode(3)));
let listB = new ListNode(5, new ListNode(6, new ListNode(4)));
@alanbsmith
alanbsmith / Cocktail Starter List.md
Created November 17, 2021 20:38
A cocktail starter list and things to have on-hand for making drinks at home

Cocktail Starter List

Below are lists of simple cocktails to make at home that often share the same ingredients. If you're getting started, this is a great list to get some classic cocktails under your belt and practice your technique.

Great Starter Cocktails

Gin

  • Gin & Tonic - gin / tonic / fresh lime or lemon
  • Gimlet - gin / simple syrup / fresh lime
@roginfarrer
roginfarrer / css-vars-system-props.js
Created January 16, 2021 20:40
CSS Vars with System Props
// Box takes in props that then assigns each responsive prop to the appropriate breakpoint
// Negates needing to update breakpoints based on theme within the styled-component
const Box = styled.div`
// base styles
@media screen and (min-width: ${props => props.breakpoints.breakpointOne}) {
// other styles
}
@media screen and (min-width: ${props => props.breakpoints.breakpointTwo}) {
@threepointone
threepointone / feature-flags-client-implementation.md
Last active June 1, 2023 18:35
Implementing a client for feature flags

On implementing a client for feature flags in your UI codebase

This document isn't an explainer on Feature Flags, you can find that with my amateur writeup, or literally hundreds of better writeups out there.

This document is also agnostic to the choice of service you'd use: LaunchDarkly or split.io or optimizely or whatever; that's orthogonal to this conversation.

Instead, this document is a list of considerations for implementing a client for using Feature Flags for User Interface development. Service providers usually give a simple fetch and use client and that's it; I contend that there's a lot more to care about. Let's dive in.

To encourage usage, we'd like for the developer experience to be as brutally simple as possible. So, this should be valid usage:

@threepointone
threepointone / iframe.tsx
Created December 8, 2020 00:16
An iframe loader powered by Suspense
import { Suspense, useLayoutEffect, useRef, useState } from 'react';
type IFrameProps = React.ComponentPropsWithRef<'iframe'> & {
fallback?: JSX.Element;
};
export function IFrame(props: IFrameProps) {
const { fallback, ...rest } = props;
return (
@threepointone
threepointone / durable-objects-001-fundamentals.md
Last active June 16, 2024 18:49
Notes on Durable Objects. Part 1 - Migrations.

Note: Since writing this, I've been pointed to some exciting new research/tooling called Project Cambria https://www.inkandswitch.com/cambria.html I'll likely have to rewrite this article taking that into account. Leaving this up for posterity's sake.


(This series isn't meant to be a primer/tutorial, though we might do something regarding it in the future. For official documentation and starters, see https://developers.cloudflare.com/workers/learning/using-durable-objects.

Further - these are my personal views; I expect to be wrong about a lot of them. Indeed, I'm not paying much attention to presenting these well at the moment, simply writing down thoughts. As such, expect these writeups to change often, particularly as the platform takes shape. I'm also mostly a front end guy, so don't get mad if I get it very wrong. Give me feedback! Always happy to learn and make changes.)

Durable Objects are a fascinating new storage primitive from cloudflare for their workers platform. There's a lot of 'cool'

type Cache = Map<string, any>
type Loader = (key: string) => Promise<any>
enum Status {
Pending,
Resolved,
Rejected,
}
interface Resource {
status: Status
value: Promise<any>
/**
* @typedef {Object} ClassifyProps
* @property {React.ElementType} [as] - Element to render
* @property {import('clsx').ClassValue} [className] - Composable classnames passed to clsx
*/
/**
* @param {ClassifyProps} props
*/
function Classify({ as: El = "div", ...props }) {
@sgregson
sgregson / inline_buildkite_video_links.user.js
Last active August 27, 2020 16:55
Buildkite inline video annotations from link URL