This file contains hidden or 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
const fs = require("fs"); | |
const sqlite3 = require("sqlite3"); | |
const glob = require("glob"); | |
const os = require("os"); | |
const { open } = require("sqlite"); | |
const username = os.userInfo().username; | |
const ANNOTATION_DB_PATH = `/users/${username}/Library/Containers/com.apple.iBooksX/Data/Documents/AEAnnotation/`; | |
const BOOK_DB_PATH = `/users/${username}/Library/Containers/com.apple.iBooksX/Data/Documents/BKLibrary/`; | |
const annotationsFiles = glob.sync(`${ANNOTATION_DB_PATH}/*.sqlite`); |
This file contains hidden or 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
gh pr list --state merged --json mergedAt,title,url --limit 100 | jq --arg s $1 --arg e $2 ' | |
[($s, $e) | strptime("%Y-%m-%d")[0:3]] as $r | |
| map(select( | |
(.mergedAt[:19] | strptime("%Y-%m-%dT%H:%M:%S")[0:3]) as $d | |
| $d >= $r[0] and $d <= $r[1] | |
)) | |
' |
This file contains hidden or 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
(() => { | |
const rootStyle = document.querySelector(":root").style; | |
const scrollMaxY = window.scrollMaxY || (document.documentElement.scrollHeight - document.documentElement.clientHeight); | |
rootStyle.setProperty("--scroll-y-max-position", scrollMaxY) | |
rootStyle.setProperty("--scroll-y-position", window.scrollY) | |
rootStyle.setProperty("--scroll-y-progress", scrollMaxY ? window.scrollY / scrollMaxY : 1) | |
document.addEventListener("scroll", () => { | |
rootStyle.setProperty("--scroll-y-position", window.scrollY) | |
rootStyle.setProperty("--scroll-y-progress", window.scrollY / scrollMaxY) | |
}) |
This file contains hidden or 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
const fruits = ["apple", "banana", "cherry", "orange"] as const | |
type Fruit = typeof fruits[number] | |
const myFruit: Fruit = "cherry" | |
function isFruit(some: unknown): some is Fruit { | |
return fruits.includes(some as any) | |
} |
This file contains hidden or 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
# Defining variables | |
OUT_DIR := build | |
BIN := node_modules/.bin | |
ESBUILD_WATCH := | |
define TS_CONFIG | |
{ | |
"compilerOptions": { | |
"strict": true, | |
"module": "commonjs", |
This file contains hidden or 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
// Async variant | |
const m = { myModule: undefined } | |
;(async () => { | |
const myModule = await import( | |
URL.createObjectURL( | |
new Blob( | |
[ | |
`export let Value = 123 | |
`, | |
], |
This file contains hidden or 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
use_bpm 55 | |
live_loop :snare do | |
sample :bd_haus, pitch: 12 | |
sleep 0.5 | |
end | |
live_loop :bam do | |
sleep 0.5 | |
sample :bd_haus | |
end |
This file contains hidden or 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
const items = [ | |
{ name: "john", fullname: "John Doe" }, | |
{ name: "batman", fullname: "Bryce Wayne" }, | |
] |
This file contains hidden or 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
import * as React from "react" | |
import { useState, useEffect, useRef } from "react" | |
import { Override, motion } from "framer" | |
// Override | |
export function OnScreen(props): Override { | |
const ref = useRef() | |
const [wasShown, setWasShown] = useState(false) | |
const onScreen = useOnScreen(ref) |
This file contains hidden or 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
yarn add @types/react @types/react-dom html-webpack-plugin ts-loader typescript webpack webpack-cli webpack-dev-server --dev |
NewerOlder