Skip to content

Instantly share code, notes, and snippets.

View zaydek's full-sized avatar
🤠
Howdy!

Z 🏴‍☠️ zaydek

🤠
Howdy!
View GitHub Profile
Details Something small enough to escape casual notice.
const defaultTheme = require("tailwindcss/defaultTheme")
function trimWhitespace(str) {
return str.split(/\s+/).join(" ").trim()
}
module.exports = {
purge: [
"./public/**/*.html",
"./src/**/*.js",
import React from "react"
import uuid from "uuid/v4"
import { useImmerReducer } from "use-immer"
// Asserts on undefined, false, -1, null.
function assert(value) {
if (value !== undefined && value !== false && value !== -1 && value !== null) {
return
}
throw new Error(`assert: value assertion; value=${value}`)
@zaydek
zaydek / test.md
Last active August 12, 2020 12:40

**Test** -> <strong>test</strong>

@zaydek
zaydek / run.sh
Last active September 6, 2020 14:01
Documents a dark mode bug in Tailwind CSS 1.8.3 (missing dark:bg-* classes).
yarn tailwind build -c tailwind.test.config.js -o test.output
@zaydek
zaydek / machine.js
Last active September 19, 2020 18:42
Generated by XState Viz: https://xstate.js.org/viz
const switchMachine = Machine({
id: 'switch',
initial: 'disabled',
states: {
disabled: {
on: {
TOGGLE: "enabled",
},
},
enabled: {
@zaydek
zaydek / machine.js
Last active September 19, 2020 19:22
Generated by XState Viz: https://xstate.js.org/viz
const delayedSwitch = Machine({
id: "delayedSwitch",
initial: "disabled",
states: {
switchToDisabled: {
after: {
1e3: "disabled",
},
},
disabled: {
@zaydek
zaydek / machine.js
Created September 19, 2020 19:32
Generated by XState Viz: https://xstate.js.org/viz
const userMachine = Machine({
id: "user",
initial: "loading",
states: {
loading: {
invoke: {
id: "loadingHandler",
src: (ctx, _) => (callback, _) => {
setTimeout(() => {
callback("success")
@zaydek
zaydek / machine.js
Last active September 19, 2020 19:41
Generated by XState Viz: https://xstate.js.org/viz
const fetchMachine = Machine({
id: "fetch",
initial: "fetching",
states: {
// idle: {
// on: {
// FETCH: "fetching",
// },
// },
fetching: {
@zaydek
zaydek / machine.js
Created September 19, 2020 19:58
Generated by XState Viz: https://xstate.js.org/viz
const naiveRefetchForeverMachine = Machine({
id: "naiveRefetchForever",
initial: "fetching",
states: {
fetching: {
invoke: {
id: "fetchHandler",
src: (ctx, e) => new Promise((resolve, reject) => {
setTimeout(() => {
// if (Math.random() < 0.5) {