Skip to content

Instantly share code, notes, and snippets.

View swyxio's full-sized avatar
🎯
Focusing

swyx.io swyxio

🎯
Focusing
View GitHub Profile
import React from "react";
export type ColorScheme = "light" | "dark";
export default function useColorSchemePreference(
defaultColorScheme: ColorScheme = "light"
) {
let darkQuery = "(prefers-color-scheme: dark)";
let [colorScheme, setColorScheme] = React.useState<ColorScheme>(
typeof window === "object" && window.matchMedia
@swyxio
swyxio / index.android.js
Created February 6, 2020 03:28
iowa caucus app bundle. have fun.
This file has been truncated, but you can view the full file.
var __BUNDLE_START_TIME__=this.nativePerformanceNow?nativePerformanceNow():Date.now(),__DEV__=false,process=this.process||{};process.env=process.env||{};process.env.NODE_ENV=process.env.NODE_ENV||"production";
@swyxio
swyxio / reactor-needed-details-Oct-Svelte.md
Last active September 25, 2019 21:14 — forked from bnb/reactor-needed-details.md
reactor-needed-details-Oct-Svelte.md
@swyxio
swyxio / 0_reuse_code.js
Created November 10, 2016 20:52
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console