Skip to content

Instantly share code, notes, and snippets.

This middleware does a few interesting things:

  • Ensures a url shape in the zustand store, where we'll store URL information.
  • Assumes we will be storing our url state slice in the ?state search parameter after it has been stringified and base 64 encoded.
  • On creation, decodes stores state from the ?state search parameter into the url slice of our store.
  • After each state update, updates the ?state search parameter with the new url state slice.
  • Sets up an event listener that listens for popstate and re-decodes the state from the URL into our store.
@snax4a
snax4a / tinysync.ts
Created July 19, 2022 10:16 — forked from lawrencecchen/tinysync.ts
A Typescript first queue/job/schedule engine.
// i like trpc. i like autocomplete. i like vercel/serverless.
// netlify acquired quirrel.
// theo would shill for a type safe option.
// there's a gap for a type-safe scheduling/cron/queuing/realtime and i want to fill it.
// also, quirrel has weird syntax for
// framing: typescript-first bindings for what you would typically use redis for
const appRouter = createRouter();
@snax4a
snax4a / private_fork.md
Created February 5, 2022 09:16 — forked from 0xjac/private_fork.md
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git

@snax4a
snax4a / node_nginx_ssl.md
Created September 23, 2019 22:33 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to Digital Ocean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user