Skip to content

Instantly share code, notes, and snippets.

View wyattjoh's full-sized avatar
🏳️‍🌈

Wyatt Johnson wyattjoh

🏳️‍🌈
View GitHub Profile
@wyattjoh
wyattjoh / AutoSave.tsx
Created September 3, 2019 21:08
AutoSave when included in a final-form Form, will automatically call the save method if any field value changes after a debounce timeout. AutoSave is based on the example from: https://codesandbox.io/s/5w4yrpyo7k
import diff from "object-diff";
import React, { useCallback, useEffect, useState } from "react";
import { FormSpy } from "react-final-form";
import { Omit } from "coral-framework/types";
interface Props<T> {
onSave: (values: T) => Promise<void>;
values: T;
debounce: number;
@wyattjoh
wyattjoh / main.go
Last active December 8, 2022 15:36
package main
import (
"encoding/json"
"flag"
"log"
"net/http"
"os"
)