Skip to content

Instantly share code, notes, and snippets.

View jaredatron's full-sized avatar

Jared Grippe jaredatron

View GitHub Profile
jaredatron / parcel_routes.js
Last active March 9, 2023 17:30
putting parcel server behind development server because parcel's proxy features are inflexible
import Path from 'path'
import express from 'express'
import Router from 'express-promise-router'
import { createProxyMiddleware } from 'http-proxy-middleware'
import env from '../env.js'
let assetsRoutes, indexHtmlFallback
// proxy requests to `parcel serve` process
jaredatron / router.js
Created January 25, 2023 23:20
Next.js 13 app dir like routing using React Router
import * as React from 'react'
import { createBrowserRouter, RouterProvider, Navigate, useLocation } from 'react-router-dom'
import { getLoginUrl } from '~/client/lib/urls'
import { useCurrentUser } from '~/client/hooks/auth'
import AppError from '~/client/components/AppError'
import FullPageLoading from './components/FullPageLoading'
import routeFiles from './routes/**/{Error,NotFound,Layout,Page}.js'
jaredatron / add_all.js
Created July 18, 2022 21:19
add all photos to an google photos album
// make new album and go to the add images page then run this script in the console
stopIt = false
;(async () => {
const scrollParent = $('.Purf9b')
const wait = async ms => {
await new Promise((r, rj) => {
setTimeout(() => { r() }, ms)
jaredatron / example.bash
Last active April 16, 2021 20:35
tail a hypercore given its public key
hyperspace-simulator tail_hypercore.js -- 0ce9e824c768daf0564f6f1ec24e04430111b8845476464ffbf60e8e3ef06347
jaredatron / track_back_and_forward_push_state.js
Last active October 10, 2020 00:50
How to track back and forward capability using history push state
This is an example of how one could track if going back or forward is
an option for the user.
if (!window.history.state || !window.history.state.visitedAt){
{...history.state, visitedAt:},
jaredatron / CropImage.js
Created June 17, 2020 23:27
Example of using ReactCrop react-image-crop
import React, { useRef, useState } from 'react'
import PropTypes from 'prop-types'
import ReactCrop from 'react-image-crop'
import 'react-image-crop/dist/ReactCrop.css'
export default function CropImage({
className = '',
jaredatron / RawHTML.js
Last active June 9, 2020 01:02
Rendering raw HTML as Preact components
import { h, Fragment } from 'preact'
import { memo } from 'preact/compat'
import PropTypes from 'prop-types'
import Link from 'components/Link'
const RawHTML = memo(({source = '', ignoreNodes = []}) => {
const parser = new global.DOMParser()
const doc = parser.parseFromString(source, "text/html")
const options = {
#!/usr/bin/env node
function sortSortedWithArrayManipulation(a, b){
a = [...a]
b = [...b]
const sorted = []
while (a.length || b.length){
if (a.length === 0){
jaredatron /
Created June 11, 2019 20:18
do this to stop Epic Games Launcher from starting at launch boot
launchctl unload ~/Library/LaunchAgents/com.epicgames.launcher.plist
rm ~/Library/LaunchAgents/com.epicgames.launcher.plist
#!/usr/bin/env node
const fs = require('fs')
const words = fs.readFileSync('/usr/share/dict/words').toString().split(/\n+/g)
const spells = ["Abi-Dalzim’s Horrid Wilting","Absorb Elements","Acid Splash","Aganazzar’s Scorcher","Aid","Alarm (Ritual)","Alter Self","Animal Friendship","Animal Messenger (Ritual)","Animal Shapes","Animate Dead","Animate Objects","Antilife Shell","Antimagic Field","Antipathy/Sympathy","Arcane Eye","Arcane Gate","Arcane Lock","Armor of Agathys","Arms of Hadar","Astral Projection","Augury (Ritual)","Aura of Life","Aura of Purity","Aura of Vitality","Awaken","Bane","Banishing Smite","Banishment","Barkskin","Beacon of Hope","Beast Bond","Beast Sense (Ritual)","Bestow Curse","Bigby’s Hand","Blade Barrier","Blade Ward","Bless","Blight","Blinding Smite","Blindness/Deafness","Blink","Blur","Bones of the Earth","Booming Blade","Branding Smite","Burning Hands","Call Lightning","Calm Emotions","Catapult","Catnap","Cause Fear","Ceremony (Ritual)","Chain Lightning","Chaos Bolt","Charm Monster",