Skip to content

Instantly share code, notes, and snippets.

View RedHatter's full-sized avatar

Ava Johnson RedHatter

View GitHub Profile
@RedHatter
RedHatter / ButtonGroup.svelte
Created February 11, 2021 05:29
Svelte form and input components with buildt-in validation
<script>
import { onMount, createEventDispatcher } from 'svelte'
import { getContext } from './Form.svelte'
const dispatch = createEventDispatcher()
export let value = ''
export let options = {}
let className
export { className as class }
@RedHatter
RedHatter / main.js
Created October 4, 2022 08:25
Scrap amazon order history and download invoices as PDFs
import puppeteer from "puppeteer";
function clickLink(page, selector) {
return Promise.all([page.click(selector), page.waitForNavigation()]);
}
const USERNAME = "[email protected]";
const PASSWORD = "************";
const PAGES = 2;
{
"name": "OnShape",
"start_url": "https://cad.onshape.com/documents/",
"icons": [
{
"src": "https://cad.onshape.com/favicon.png",
"sizes": "144x144",
"type": "image/png"
}
],
@RedHatter
RedHatter / useDeepMemo.ts
Created August 29, 2024 20:16
A simple react form handling hook
import { DependencyList, useMemo, useRef } from 'react'
import * as R from 'remeda'
/**
* `useDeepMemo` will only recompute the memoized value when one of the
* `dependencies` has changed by value.
*
* Warning: `useDeepMemo` should not be used with dependencies that
* are all primitive values. Use `React.useMemo` instead.