Skip to content

Instantly share code, notes, and snippets.

View zaydek's full-sized avatar
🤠
Howdy!

Zaydek MG zaydek

🤠
Howdy!
View GitHub Profile
import { variantImportant, variantVariables } from "@unocss/preset-mini/variants"
import { Extractor, Rule } from "unocss"
import { defineConfig } from "unocss/vite"
////////////////////////////////////////////////////////////////////////////////
// Extractors
// TODO: Get URL reference from source
// TODO: Splitting on ' and " break values such as 'tnum' and url("...")
function isValidSelector(selector: string) {
/* @refresh reload */
import "./css/reset.scss"
import "./css/duomo.scss"
import "./css/theme.scss"
import * as Solid from "solid-js"
import * as SolidWeb from "solid-js/web"
import * as helpers from "./helpers"
import * as utils from "./utils"
import * as Solid from "solid-js"
import * as u from "./utils"
import { css } from "./styled"
////////////////////////////////////////////////////////////////////////////////
type DefaultProps = {
class?: string,
dev:
npx retro dev
build:
npx retro build && cp www/_redirects out/_redirects
serve:
npx retro serve
/*! Duomo CSS | MIT | https://github.com/zaydek/duomo */*,*:before,*:after{box-sizing:border-box}:root{-moz-tab-size:4;tab-size:4}html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}body{font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"}hr{height:0;color:inherit}abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}::-moz-focus-inner{border-style:none;padding:0}:-moz-focusring{outline:1px d
/*! Duomo CSS | MIT | https://github.com/zaydek/duomo */
*,
*::before,
*::after {
box-sizing: border-box;
}
:root {
-moz-tab-size: 4;
tab-size: 4;
import create from "zustand"
import createContext from 'zustand/context'
import "./App.css"
////////////////////////////////////////////////////////////////////////////////
const LOCALSTORAGE_KEY = "zustand-todos"
function getStateLocalStorage() {
const jsonStr = window.localStorage.getItem(LOCALSTORAGE_KEY) // Zero value is `null`
@zaydek
zaydek / todos.js
Last active August 29, 2021 04:41
import "./App.css"
////////////////////////////////////////////////////////////////////////////////
// These are the possible action types our app can emit.
const TOGGLE_TODO = "TOGGLE_TODO"
const CHANGE_TODO = "CHANGE_TODO"
const COMMIT_TODO = "COMMIT_TODO"
const TOGGLE_TODO_BY_ID = "TOGGLE_TODO_BY_ID"
const CHANGE_TODO_BY_ID = "CHANGE_TODO_BY_ID"
@zaydek
zaydek / todo.js
Last active August 8, 2021 22:07
function newTodo({ checked, value } = {}) {
const id = Math.random().toString(36).slice(2, 8)
checked ??= false
value ??= ""
return Todo({
id,
checked,
value,
})
}
@zaydek
zaydek / virtualScroller.js
Created April 17, 2021 11:09
Probably a bad idea
React.useEffect(() => {
let animationFrame = 0
function virtualScroller(targets, { offset, topOffset, bottomOffset } = {}) {
offset ??= 0
topOffset ??= offset ?? 0
bottomOffset ??= offset ?? 0
cancelAnimationFrame(animationFrame)
animationFrame = window.requestAnimationFrame(() => {
for (let x = 0, len = targets.length; x < len; x++) {
let target = targets[x]