Skip to content

Instantly share code, notes, and snippets.

View timothymiller's full-sized avatar
🎄

Timothy Miller timothymiller

🎄
View GitHub Profile
@timothymiller
timothymiller / useQueryState.ts
Created September 12, 2022 14:20 — forked from SebastianHGonzalez/useQueryState.ts
useQueryState - query string synchronized use state hook for next.js
import { useState, useEffect } from "react";
import { useRouter } from "next/router";
type IParam = string;
type IValue = string | string[] | number | number[] | null | undefined;
type IState = { [k: string]: IValue };
type IQuery = IState;
type IRoute = string;
function isEmpty(value: IValue): boolean {
@KATT
KATT / _app.js
Last active June 30, 2022 11:35
Prevent Flash of Unstyled Content in Chrome
// Next.js' `_app.js` file
import Head from 'next/head';
import { useEffect, useState } from 'react';
import '../styles/main.scss';
function useIsMounted() {
const [mounted, setMounted] = useState(false);
useEffect(() => {
@JonnyWong16
JonnyWong16 / sync_playlists_to_users.py
Last active April 20, 2024 12:14
Sync Plex playlists to shared users.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Description: Sync Plex playlists to shared users.
# Author: /u/SwiftPanda16
# Requires: plexapi
from plexapi.exceptions import NotFound
from plexapi.server import PlexServer