Skip to content

Instantly share code, notes, and snippets.

@kalda341
kalda341 / editor.ts
Last active November 14, 2023 02:00
Footnote Marks
function useForceUpdate() {
const [, setValue] = useState(0);
return () => setValue((value) => value + 1);
}
function useUpdatableDep() {
const [dep, setValue] = useState(0);
return [dep, () => setValue((value) => value + 1)] as const;
}
// type map = <F, A, B>(F<A>, f: (a: A) => B) => F<B>;
// type contramap = <F, A, B>(F<A>, f: (a: A) <= B) => F<B>;
// type contramap = <F, A, B>(F<A>, f: (b: B) => A) => F<B>;
// type map = <F, A, B>(F<A>, f: (a: A) => B) => F<B>;
const eqString = Eq.fromEquals<string>((x, y) => x === y);
interface Animal {
name: string;
}
interface SingleAnimalZoo {
animal: Animal;
}
import "./styles.css";
import { function as F, option as O, either as E, readonlyArray as A, monoid as Monoid, readonlyNonEmptyArray as NEA } from 'fp-ts';
import { some } from "fp-ts/lib/ReadonlyRecord";
const invert = (x: number): E.Either<string, number> => {
if (x === 0) {
return E.left("Cannot divide by 0");
} else {
return E.right(1 / x);
}
import "./styles.css";
import { function as F, option as O, readonlyArray as A, monoid as Monoid, readonlyNonEmptyArray as NEA } from 'fp-ts';
import { some } from "fp-ts/lib/ReadonlyRecord";
export default function App() {
return (
<div className="App">
<h1>Hello CodeSandbox</h1>
<h2>Start editing to see some magic happen!</h2>
</div>
type JSONValue =
| string
| number
| null
| boolean
| JSONValue[]
// Record<string, JSONValue> is a circular value, so doesn't work.
// This is semantically equivalent.
| { [K: string]: JSONValue | undefined };
export const overlayDocMap = new Map<string, readonly string[]>([
// Natural Resources
['High-Use Aquifer Management Areas Overlay [rp]', ['D1']],
['Quality-Sensitive Aquifer Management Areas Overlay [rp]', ['D2']],
['High-Use Stream Management Areas Overlay [rp]', ['D3']],
['Natural Stream Management Areas Overlay [rp]', ['D4']],
['Lake Management Areas Overlay (Natural and Urban Lake) [rp]', ['D5', 'D6']],
['Water Supply Management Areas Overlay [rp]', ['D7']],
['Wetland Management Areas Overlay [rp]', ['D7']],
['Significant Ecological Areas Overlay', ['D9']],
{
"url": "https://unitaryplan.aucklandcouncil.govt.nz/Images/Auckland%20Unitary%20Plan%20Operative/Chapter%20E%20Auckland-wide/1.%20Natural%20Resources/E14%20Air%20quality.pdf",
"activityTables": [
{
"id": "E14.4.1",
"ruleIndex": 1,
"statusRowNumber": 1,
"statusStartIndex": 2,
"numStatusColumns": 5,
"standardsIndex": null,
export const zoneDocMap = new Map<string, readonly string[]>([
['Residential - Large Lot Zone', ['H1']],
['Residential - Rural and Coastal Settlement Zone', ['H2']],
['Residential - Single House Zone', ['H3']],
['Residential - Mixed Housing Suburban Zone', ['H4']],
['Residential - Mixed Housing Urban Zone', ['H5']],
// This is old - however there may be projects using the old name
['Residential -Terrace Housing and Apartment Buildings Zone', ['H6']],
['Residential - Terrace Housing and Apartment Building Zone', ['H6']],
['Open Space - Conservation Zone', ['H7']],
export const zoneDocMap = new Map<string, readonly string[]>([
['Residential - Large Lot Zone', ['H1']],
['Residential - Rural and Coastal Settlement Zone', ['H2']],
['Residential - Single House Zone', ['H3']],
['Residential - Mixed Housing Suburban Zone', ['H4']],
['Residential - Mixed Housing Urban Zone', ['H5']],
['Residential -Terrace Housing and Apartment Buildings Zone', ['H6']],
['Residential - Terrace Housing and Apartment Building Zone', ['H6']],
['Open Space - Conservation Zone', ['H7']],
['Open Space - Informal Recreation Zone', ['H7']],