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
class PathMe { | |
moves: string[] = []; | |
constructor() { | |
this.moves = []; | |
return this; | |
} | |
moveTo(x: number, y: 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
export class FPSMeter { | |
private frames: number[] = []; | |
private lastFrameTime: number = 0; | |
private totalFrames: number; | |
private lowFPSCallback: ((fps: number) => void) | null = null; | |
constructor(totalFrames: number = 60) { |
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 http = require('http'); | |
const MAX_AGE = 5; // seconds | |
const STALE_WHILE_REVALIDATE = 200; // seconds | |
const server = http.createServer((req, res) => { | |
// Set cache control headers | |
res.setHeader('Cache-Control', `max-age=${MAX_AGE}, stale-while-revalidate=${STALE_WHILE_REVALIDATE}`); |
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
"workbench.editor.customLabels.patterns": { | |
"**/routes/**/+page.svelte": "${dirname(1)}/${dirname}", | |
"**/routes/**/+page.server.ts": "/${dirname} [server]", | |
"**/app/**/page.tsx": "${dirname}.${extname}", | |
"**/app/**/layout.tsx": "${dirname}/layout.${extname}" | |
} |
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 BlueSkyPost() { | |
const url = new URL('https://bsky.app/profile/danabra.mov/post/3la62zxt4rs2j'); | |
const details = url.pathname.split('/').filter(Boolean).reduce((acc, part, index, pathParts) => { | |
if (index % 2 === 0 && pathParts[index + 1]) { | |
acc[part] = pathParts[index + 1]; | |
} | |
return acc; | |
}, {} as Record<'post' | 'profile' | string, string>); | |
const endpoint = new URL('https://public.api.bsky.app/xrpc/app.bsky.feed.getPostThread'); | |
const params = new URLSearchParams(); |
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
// 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works | |
const axios = require('axios'); // promised based requests - like fetch() | |
function getCoffee() { | |
return new Promise(resolve => { | |
setTimeout(() => resolve('☕'), 2000); // it takes 2 seconds to make coffee | |
}); | |
} |
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
{ | |
"keys": ["tab"], | |
"command": "expand_abbreviation_by_tab", | |
// put comma-separated syntax selectors for which | |
// you want to expandEmmet abbreviations into "operand" key | |
// instead of SCOPE_SELECTOR. | |
// Examples: source.js, text.html - source | |
"context": [ | |
{ |
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 Anthropic from '@anthropic-ai/sdk'; | |
import { Glob } from 'bun'; | |
export const anthropic = new Anthropic({ | |
apiKey: process.env.ANTHROPIC_KEY | |
}); | |
const glob = new Glob("./txt/*.txt"); | |
type Page = { |
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 fixNotionPadding() { | |
Array.from(document.querySelectorAll(`[style*="padding-left: 96px"]`)).forEach(el => el.style.padding = 0); | |
requestAnimationFrame(fixNotionPadding); | |
} | |
fixNotionPadding(); |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>🔥 Make a photo booth app in about 15 lines of JavaScript</title> | |
<link rel="icon" href="https://fav.farm/🎥" /> | |
</head> | |
<body> |
NewerOlder