Skip to content

Instantly share code, notes, and snippets.

View nanderLP's full-sized avatar
:octocat:
nander.dev on Discord

Nander nanderLP

:octocat:
nander.dev on Discord
View GitHub Profile
@nanderLP
nanderLP / RouteProgressBar.tsx
Last active November 6, 2022 11:34
Router Navigation Indicator
import { useTheme } from "@chakra-ui/react";
import { AnimatePresence, motion } from "framer-motion";
import { useRouter } from "next/router";
import { FC, useEffect, useState } from "react";
/**
* Little component for Next.js that implements a UI indicator for route navigation. Made with Framer Motion
* Should be absolute positioned to the top of the page
* NOTE: Next.js 13 is not supported, as it has a different router implementation
*/
@nanderLP
nanderLP / randomString.js
Last active October 2, 2022 13:45
Variable random string with crypto
const randomString = (length) => {
return Array.from(
window.crypto.getRandomValues(new Uint8Array(length / 2)),
(d) => d.toString(16).padStart(2, "0")
).join("");
}