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
import React, { useEffect, useRef, useState } from "react"; | |
import useAudioContext from "./useAudioContext"; | |
import { AppColor, de } from "../../stylesheet"; | |
import { useStylesheet } from "../../stylesheet/hooks"; | |
const Canvas = de.createMotion.canvas` | |
width: 100%; | |
height: 100%; | |
`; |
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
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
) | |
func PrintInterface(i interface{}) error { | |
b, err := json.MarshalIndent(i, "", " ") | |
if err != nil { |
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
interface TickerConfig { | |
fn: () => Promise<void>; | |
intervalMs?: number; | |
firstRunDelay?: number; | |
} | |
class Ticker { | |
private fn: () => Promise<void>; | |
private timer?: NodeJS.Timeout; |
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
function onProcessExit(callback: () => void): void { | |
[ | |
"SIGINT", | |
"SIGTERM", | |
"SIGHUP", | |
"SIGBREAK", | |
"unhandledRejection", | |
"uncaughtException", | |
].forEach((signal: string) => { | |
process.on(signal, () => { |
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
const debug = (...messages: unknown[]) => { | |
const { stack } = new Error(""); | |
const caller = stack?.split("\n")?.[2].trim().split(" ")[1]; | |
console.log(`[ededejr|${caller}]: `, ...messages); | |
}; |
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
function useRelativeTimestamp(ts: number) { | |
const now = Date.now(); | |
let displayTime = ""; | |
const diff = now - ts; | |
const timestamp = new Date(ts); | |
if (diff <= 1000 * 60 * 60) { | |
const formatter = new Intl.RelativeTimeFormat("en", { numeric: "auto" }); |
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
import * as React from 'react'; | |
import { useMediaQuery } from '@/lib/hooks'; | |
import * as DialogParts from '@/ui/dialog'; | |
import * as DrawerParts from '@/ui/drawer'; | |
type ResponsiveDialogPartsKey = | |
| '' | |
| 'Portal' | |
| 'Overlay' |
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
import TTLCache, { Options } from '@isaacs/ttlcache'; | |
export type CacheOptions<K = string, V = unknown> = Options<K, V>; | |
export class Cacheable<K = string, V = unknown> { | |
protected cache: TTLCache<K, V>; | |
constructor(options: Options<K, V> = { ttl: 1000 * 60 * 10 }) { | |
this.cache = new TTLCache(options); | |
} |
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
import asyncio | |
import logging | |
from typing import Any, Callable, Coroutine, List, Optional | |
logger = logging.getLogger(__name__) | |
class Waitgroup: | |
def __init__(self, timeout: Optional[float] = None): | |
self.timeout = timeout |
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
import { ExecSyncOptions, execSync } from 'child_process'; | |
export function sh(command: TemplateStringsArray, ...substitutions: any[]) { | |
const fullCommand = command.reduce((acc, part, i) => acc + part + (substitutions[i] || ''), ''); | |
return (options?: ExecSyncOptions) => execSync(fullCommand, { encoding: 'utf-8', ...(options || {}) }); | |
} |
OlderNewer