Skip to content

Instantly share code, notes, and snippets.

View beaucollins's full-sized avatar
🃏
Special Author

Beau Collins beaucollins

🃏
Special Author
View GitHub Profile
Documentation https://candidate.commonroom.dev/api-docs/index.html#quotes
TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJiZWF1QGNvbW1vbnJvb20uaW8iLCJqdGkiOiIwMUVLWEJURDJIOE00WTJUR01DNVc5MUcxSyIsImlhdCI6MTYwMTkzNDUzNywibmJmIjoxNjAxOTM0NTM3LCJleHAiOjE2MDE5NDUzMzcsImh0dHBzOi8vY2FuZGlkYXRlLmNvbW1vbnJvb20uaW8vYXNzZXNzbWVudCI6InBhaXJpbmciLCJzY29wZSI6InF1b3RlcyBhbmFseXNpczplYXJsaWVzdCBhc3Nlc3NtZW50In0.g46y4G_8_pNN1Uu4AvVtm_NF_sLD1FKrd1FbZUAwdGI
ENDPOINT=https://candidate.commonroom.dev/quotes
type SlackEvent<
E extends string,
S extends string | undefined,
T extends Record<string, unknown>
> = {
type: E;
subtype: S;
} & T;
export type SlackEditEventPayload = SlackEvent<
type Brand<T, K> = T & { __brand: K };
type CommunityId = Brand<number, 'CommunityId'>;
type PostId = Brand<number, 'PostId'>;
type MemberId = Brand<number, 'MemberId'>;
type Post = {
communityId: CommunityId,
postId: PostId,
authorId: MemberId
@beaucollins
beaucollins / foo.ts
Last active September 17, 2020 19:05
import knex, { Client } from 'knex';
type Result =
| [success: true, database: string]
| [success: false, database: string, reason: Error];
const ENV = process.env.NODE_ENV ?? 'development';
function createClient() {
if (ENV !== 'development') {
throw new Error(`Only development ${ENV}`);
#!/bin/sh
remote="$1"
url="$2"
z40=0000000000000000000000000000000000000000
while read local_ref local_sha remote_ref remote_sha
do
if [ "$local_sha" = $z40 ]
/**
* Take an `any` and turn it into something else.
*/
export type Failure = Readonly<{type: 'failure', reason: string, value: any}>;
export type Success<T> = Readonly<{type: 'success', value: T}>
export type Result<T> = Success<T> | Failure;
export type Validator<T> = (value: any) => Result<T>;
export function isString(value: any): Result<string> {

Gutenbuild

Zero to Gutenburg with Docker.

Scenario

You want to add a Gutenburg block to your WordPress plugin. You don't want to install the npms and the nodes. You want to get stuff done.

Enter gutenbuild.

/** @format */
// flow-typed signature: 313cef7b9950a1fea79cecdc23f0050c
// flow-typed version: <<STUB>>/react-stripe-elements_v2.0.3/flow_v0.95.1
/**
* This is an autogenerated libdef stub for:
*
* 'react-stripe-elements'
*
Error ----------------------------------------------------------------------- ../happy-tools/apps/core/src/apps.js:14:31
Cannot resolve module `core/src/app-host`.
14| import { switchAppHost } from 'core/src/app-host';
^^^^^^^^^^^^^^^^^^^
Error ------------------------------------------------ ../happy-tools/apps/core/src/components/apps-menu/index.jsx:15:18
Error ----------------------------------------------------------------------- ../happy-tools/apps/core/src/apps.js:14:31
Cannot resolve module `core/src/app-host`.
14| import { switchAppHost } from 'core/src/app-host';
^^^^^^^^^^^^^^^^^^^
Error ------------------------------------------------ ../happy-tools/apps/core/src/components/apps-menu/index.jsx:15:18