repeat |
---|
5 |
yarn webpack
import { type Provide, ensure, resource } from "effection"; | |
import { type Draft, type Patches, create } from "mutative"; | |
import { match } from "ts-pattern"; | |
export interface KVStore { | |
get(key: string): Operation<unknown>; | |
put(key: string, value: unknown): Operation<void>; | |
putBatch(entries: Record<string, unknown>): Operation<void>; | |
delete(key: string): Operation<void>; | |
deleteBatch(keys: string[]): Operation<void>; |
export function fetch(...[input, init]: FetchParams): Operation<Response> { | |
return action((resolve, reject) => { | |
const internalController = new AbortController(); | |
const signal = internalController.signal; | |
if (init?.signal) { | |
init.signal.addEventListener("abort", () => internalController.abort()); | |
} | |
try { |
#!/bin/bash | |
set -euo pipefail | |
FROM=$1 | |
TO=$2 | |
NEW_NAME=${3:-$FROM} | |
cd "$FROM" | |
FROM=$(pwd) | |
# Uses https://github.com/newren/git-filter-repo |
const Never = undefined as never; | |
export class Result<T extends "ok" | "error", D, E extends Error> { | |
private constructor( | |
public readonly type: T, | |
public readonly data: T extends "ok" ? D : never = Never, | |
public readonly error: T extends "error" ? E : never = Never | |
) {} | |
static ok<T>(value: T): Result<"ok", T, never> { |
// This script is adapted from david fahlander's post: https://dfahlander.medium.com/export-indexeddb-from-a-web-app-using-devtools-62c55a8996a1 | |
// You should be able to drop this in the console on a riverside.fm page once you're logged in. | |
// Find the indexdb table name that you want to import by 2. Include dexie-export-import into the page. | |
const dbName = 'export-db' | |
const loadScript = src => | |
new Promise(resolve => { | |
let script = document.createElement('script') | |
script.src = src; |
// Don't allow this | |
export const ArrowComponent = () => ( | |
<div> | |
<h1>My special implicit arrow function</h1> | |
</div> | |
) | |
// This is okay | |
export const SimpleComponent = () => <h1>This is fine</h1> |
package.json
by running yarn version --prerelease --preid=canary
npm publish --tag canary
to publish the package under the canary
tagyarn add @artsy/reaction@canary
to install canary packageRunning npm dist-tag ls
can be helpful to see what tagged packages are available
import { NowRequest, NowResponse } from "@now/node"; | |
import { http, https } from "follow-redirects"; | |
import { URL } from "url"; | |
export = (request: NowRequest, response: NowResponse) => { | |
console.log(request.headers); | |
const event = request.headers["x-github-event"]; | |
if (!event) return response.status(404).end(); | |
const url = new URL(`https://${request.headers.host}/${request.url}`); |
// uses mocha | |
const { rgb } = require("wcag-contrast"); | |
const fromHex = require("@fantasy-color/from-hex").default; | |
const fs = require("fs"); | |
const assert = require("assert"); | |
const parsedColors = fs | |
.readFileSync(__dirname + "/../parsed-colors.txt") | |
.toString() | |
.split("\n") |