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
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 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 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 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 like this: node --import logger.js yourapp.js | |
import path from 'path'; | |
const { log } = console; | |
[`debug`, `log`, `warn`, `error`, `table`, `dir`].forEach((methodName) => { | |
const originalLoggingMethod = console[methodName]; | |
console[methodName] = (...args) => { | |
const originalPrepareStackTrace = Error.prepareStackTrace; | |
Error.prepareStackTrace = (_, stack) => stack; |
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
class PathMe { | |
moves: string[] = []; | |
constructor() { | |
this.moves = []; | |
return this; | |
} | |
moveTo(x: number, y: number) { |
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 dotenv from "dotenv"; | |
import { readFile, writeFile } from 'fs/promises'; | |
dotenv.config(); | |
import { Configuration, OpenAIApi } from "openai"; | |
const configuration = new Configuration({ | |
apiKey: process.env.OPENAI_API_KEY, | |
}); | |
export const openai = new OpenAIApi(configuration); |
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
{ | |
"editor.tokenColorCustomizations": { | |
// just one | |
"comments": { | |
"fontStyle": "italic", | |
}, | |
// multiple scopes | |
"textMateRules": [ | |
{ | |
"scope": [ |
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
// Here we check if our custom type "Stringy" extends a narrow type of '' | |
// If it does, the type is never | |
// If it doesnt, the type is "Strinfy", which is just a string type | |
function getItem<Stringy extends string>( | |
id: Stringy extends '' ? never : Stringy | |
) { | |
// code here | |
} | |
// works: | |
getItem('abc123'); // No error |
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
<!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