based on the
Thank you for your interest in contributing to PartyKit, Inc.'s PartyKit ("We" or "Us").
function sleep(ms: number) { | |
return new Promise((resolve) => setTimeout(resolve, ms)); | |
} | |
export default { | |
async fetch(): Promise<Response> { | |
// a simple streaming response | |
const encoder = new TextEncoder(); |
These are my eggs. I like this recipe because it's delicious, doesn't take too much time to make, and goes well with other meals in my life.
All instructions are negotiable, adjust based on vibes.
Start by slicing up an onion. I like using a milder tasting onion, or a banana shallot. I like slices so I can taste it in the final product, but feel free to chop it finer if you'd like.
In a bowl, make the 'sauce'. A teaspoon each of gochugang paste, soy sauce, sesame oil, a couple of pinches of brown sugar, mirin or rice vinegar (I prefer mirin because it doesn't smell as strong, but the vinegar is more 'traditional'). Also add a teaspoon of garlic paste, and a teaspoon of ginger paste.
The Questions (and answers) Technically, these are statements, not questions, but... what the hell!
Question 1 God exists.
Question 2 God is a logical possibility (i.e., there is nothing contradictory about the very idea of God).
// recursively get all files in a folder | |
function* getAllFiles(dirPath: string): Iterable<string> { | |
for (const file of fs.readdirSync(dirPath)) { | |
const pathToCheck = path.join(dirPath, file); | |
if (fs.statSync(pathToCheck).isDirectory()) { | |
if (file !== 'node_modules') { | |
yield* getAllFiles(pathToCheck); | |
} | |
} else { | |
yield pathToCheck; |
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:
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 ( |
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'
import tree from "./tree"; | |
test("it should serialise the tree", () => { | |
expect(tree("path/to/folder")).toMatchInlineSnapshot(); // jest will fill this in automatically | |
}); |
(I'm enjoying doing these raw, barely edited writeups; I hope they're useful to you too)
This is my own writeup on feature flags; for a deep dive I'd recommend something like Martin Fowler's article (https://martinfowler.com/articles/feature-toggles.html).
So. Feature flags. The basic idea that you'll store configuration/values on a database/service somewhere, and by changing those values, you can change the user experience/features for a user on the fly.
Let's say that you're building a new feature, called 'new-button' which changes the color of buttons, which is currently red, to blue. Then you'd change code that looks like this -