This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @public | |
* @typedef {'rem' | 'px'} Unit | |
*/ | |
/** | |
* @public | |
* @typedef {`${number}${Unit}`} Length | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env fish | |
set --local count $argv[1] | |
set --local percentage $(math 100 / $count) | |
for i in (seq 0 $(math $count - 1)) | |
set --local offset $(math $percentage / 100 \* $i) | |
magick image.png -gravity North -crop "100%x$percentage%+0+%[fx:h*$offset]" "cropped-$i".jpg | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable @typescript-eslint/no-explicit-any */ | |
import { getContext, setContext } from 'svelte'; | |
type Snapshot<T = any> = { | |
capture: () => T; | |
restore: (value: T) => void; | |
}; | |
export function provideSnapshot() { | |
const snapshots: Record<string, Snapshot> = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script lang="ts"> | |
export let open = false; | |
let cls =''; | |
export { cls as class }; | |
</script> | |
<div class="grid-collapsible {cls}" data-open={open.toString()}> | |
<div class="grid-collapsible-content"> | |
<slot /> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://zod.dev/ | |
import { z } from 'zod'; | |
import ja from './ja.json'; | |
import en from './en.json'; | |
type RecursiveStringRecord = { | |
[key: string]: string | RecursiveStringRecord; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# idea from Vertasium video: https://www.youtube.com/watch?v=iSNsgj1OCLA | |
from typing import Callable | |
import numpy as np | |
import random | |
import matplotlib.pyplot as plt | |
from matplotlib.ticker import PercentFormatter | |
def no_strategy(number: int, boxes: list[int]) -> bool: | |
open_boxes = random.sample(boxes, int(len(boxes) / 2)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type DeepObject<T> = { | |
[key: string]: T | DeepObject<T>; | |
}; |