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
function formatDuration(seconds: number): string { | |
let m = Math. floor (seconds / 60); | |
let s = seconds % 60; | |
return `${m}:${s.toString().padStart(2, "0")}`; | |
} |
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
<script lang="ts"> | |
import { scale } from 'svelte/transition'; | |
let hoveredIndex = $state(null as number | null); | |
let selected = $state(null as number | null); | |
// Create an array of years from 1993 to 2024 | |
let YEARS = Array.from({ length: 2024 - 1993 + 1 }, (_, i) => 2024 - i); | |
let handleMouseEnter = (index: number) => { |
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
type Options = { | |
/** The time before the copied status is reset. */ | |
delay: number; | |
/** Whether to reset the copied status after a delay. */ | |
reset: boolean; | |
}; | |
/** Use this hook to copy text to the clipboard and show a copied state. | |
* | |
* ## Usage |
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 { FFmpeg } from '@ffmpeg/ffmpeg'; | |
import { toBlobURL } from '@ffmpeg/util'; | |
let ffmpeg: FFmpeg | null = null; | |
export const initFFmpeg = async (): Promise<FFmpeg> => { | |
if (ffmpeg) return ffmpeg; | |
ffmpeg = new FFmpeg(); | |
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
export async function getStars(): Promise<string> { | |
try { | |
const res = await fetch( | |
"https://api.github.com/repos/milksense/milksense", | |
{ | |
next: { revalidate: 3600 }, | |
} | |
); | |
if (!res.ok) { |
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
<script lang="ts"> | |
import { dev } from "$app/environment"; | |
</script> | |
{#if dev} | |
<div | |
data-tailwind-indicator="" | |
class="fixed bottom-1 left-1 z-50 flex h-6 w-6 items-center justify-center rounded-full bg-gray-800 p-3 font-mono text-xs text-white" | |
> | |
<div class="block sm:hidden">xs</div> |
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
type TODO = 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
import { browser } from "$app/environment" | |
export function useIsMac(): { readonly current: boolean } { | |
const isMac = $derived(browser | |
? "userAgentData" in navigator | |
? navigator.userAgentData?.platform.includes("macOS") | |
: navigator?.platform.includes("Mac") | |
: false | |
) |
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 { tick } from "svelte"; | |
/** | |
* Svelte action to focus an element after it is rendered. | |
* Add use:focusOnRender to HTML element to focus it after it is rendered. | |
* @param elementRef The HTML element to focus. | |
*/ | |
export function focusOnRender(elementRef: HTMLElement | null) { | |
async function update() { | |
await tick(); // Wait for the DOM to update |
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
var d = Object.defineProperty; | |
var v = (o, e, t) => e in o ? d(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t; | |
var n = (o, e, t) => v(o, typeof e != "symbol" ? e + "" : e, t); | |
class w { | |
constructor({ | |
postBackButtonEvent: e, | |
onClick: t, | |
offClick: s | |
}) { | |
n(this, "visible", !1); |
NewerOlder