Skip to content

Instantly share code, notes, and snippets.

@Sutil
Sutil / form.tsx
Last active April 26, 2024 05:28
Shandcn UI Money Mask Input - NextJS.
"use client";
import { zodResolver } from "@hookform/resolvers/zod";
import { useForm } from "react-hook-form";
import MoneyInput from "src/components/custom/money-input";
import { Button } from "src/components/ui/button";
import { Form } from "src/components/ui/form";
import * as z from "zod";
const schema = z.object({
@aprovecharLab
aprovecharLab / spectrograms.ipynb
Created February 26, 2019 17:20
Fun with Continuous Wavelet Transform Spectrograms
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@brooksvb
brooksvb / Uptime-Kuma-Status-Page-Dark-Mode-High-Density-Tweaks.css
Last active April 26, 2024 05:28
These CSS tweaks are for higher density display for Uptime Kuma status pages in dark mode.
:root {
--min-item-width: 28ch;
--max-item-width: .5fr;
--grid-spacing: .25rem;
--item-padding: .25rem;
}
/* Let items expand on small screens */
@media (max-width: 600px) {
:root {
:root {font-size: 16px; line-height: 1.5; font-family: sans-serif; padding: 20px}
body {}
h1 {font-size:2rem; margin-bottom:1rem; line-height: 1}
h2 {font-size:1.5rem; margin-bottom: .5rem;}
p {margin-bottom: 1rem;}
@fitsum
fitsum / ticker.js
Last active April 26, 2024 05:26
request animation frame
var now, dt,
rate = 0.5,
last = performance.now();
function frame() {
now = performance.now();
dt = (now - last) / 1000; // duration in seconds
if(dt >= rate){
console.log("bing")
last = now;
File 1 conents
@fitsum
fitsum / dumb-console-animation.js
Last active April 26, 2024 05:25
dumb console animation
var angle = null,
step = 20,
rate = 90;
draw = () => {
if (!angle) {
angle = 0;
}
console.clear();
@fitsum
fitsum / transform-selected-text.js
Last active April 26, 2024 05:24
CSS transform selected text - NEEDS WORK
// From browser source/snippets
// TODO: use selection API
// IDEA: selecting -> uppercase => voices -> yelling one word at a time (AWS?)
//noting line breaks in chrome devtools between selection and post slice
//FIXME: better attach
document.styleSheets[document.styleSheets.length - 1].addRule("::selection", "background: red !important; color: pink !important; text-transform: uppercase !important");
//get whole parent
@fitsum
fitsum / replacing-in-pairs.js
Last active April 26, 2024 05:24
replaces array items in pairs
console.clear()
let used = [],
replaced = []
/*
TODO: only needed for early testing. can del
len = 20,
createArr = function(N) {
return Array.apply(null, {
length: N
const r = document.querySelector('input[type="range"]'),
initVal = 20,
story = [];
let currVal = null;
r.value = initVal;
r.addEventListener('change', (e) => {
let finalVal = e.target.value,