Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

swyx sw-yx

🎯
Focusing
View GitHub Profile
View useColorSchemePreference.ts
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
@sw-yx
sw-yx / index.android.js
Created Feb 6, 2020 — forked from jimthedev/index.android.js
iowa caucus app bundle. have fun.
View index.android.js
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";
@sw-yx
sw-yx / reactor-needed-details-Oct-Svelte.md
Last active Sep 25, 2019 — forked from bnb/reactor-needed-details.md
reactor-needed-details-Oct-Svelte.md
View reactor-needed-details-Oct-Svelte.md
@sw-yx
sw-yx / 0_reuse_code.js
Created Nov 10, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console