- Use camel case for variable and function names.
- Example: myVariable, myFunction
- Use Pascal case for class and constructor names and modubles.
- Example: MyClass, MyConstructor, MyModule
// Types for the result object with discriminated union | |
type Success<T> = { | |
data: T; | |
error: null; | |
}; | |
type Failure<E> = { | |
data: null; | |
error: E; | |
}; |
import { readFileSync } from "node:fs" | |
import * as babel from "@babel/core" | |
import BabelPluginReactCompiler from "babel-plugin-react-compiler" | |
import type { Plugin } from "esbuild" | |
import QuickLRU from "quick-lru" | |
export function ReactCompilerEsbuildPlugin({ | |
filter, | |
sourceMaps, | |
runtimeModulePath, |
{ | |
"$schema": "https://zed.dev/schema/themes/v0.1.0.json", | |
"name": "Vesper", | |
"author": "Rauno Freiberg", | |
"themes": [ | |
{ | |
"name": "Vesper", | |
"appearance": "dark", | |
"style": { | |
"border": "#101010", |
// Do enable nodejs_compat | |
// https://developers.cloudflare.com/workers/runtime-apis/nodejs/ | |
import crypto from 'node:crypto' | |
import { Context, Hono } from 'hono' | |
const app = new Hono() | |
function generateJWT(payload, secret, expiresIn) { | |
const header = { alg: 'HS256', typ: 'JWT' } | |
const encodedHeader = base64UrlEncode(JSON.stringify(header)) |
function sleep(ms) { | |
return new Promise(resolve => setTimeout(resolve, ms)); | |
} | |
async function fillQuery() { | |
question = window.location.search.split("=")[1].replace("+", " ").replace("%3F", "?").replace("%27", "'") | |
var input = document.getElementsByTagName("textarea")[0] | |
await sleep(1000); // Pause for 1 second | |
input.textContent = question | |
// input.innerText = question |
When using this prompts, make sure to reply to Clyde's last message to continue the prompt. Everytime you ping Clyde, you start a new session.
import parseDate from './parseDate.js'; | |
parseDate('1 minute'); // => 60000 | |
parseDate('1 hour'); // => 3600000 | |
parseDate('Not a date'); // => Error: Invalid format | |
/* | |
* Usage: count {unit} | |
* Units: | |
* s, second, seconds, sec |
/** | |
* Tiny customElement wrapper that enables scalable web component architecture. | |
* Define custom elements with a configuration object that separates markup from css and javascript. | |
* Uses a slotted light DOM (no shadow DOM) to allow for powerful component extension, | |
* composition and easier styling with external stylesheets and global css variables. | |
* Exports a component class that can be imported and explicitly used to be picked up by module bundlers. | |
* See comments for examples and GNU license below. | |
*/ | |
export function defineComponent(name, config) { |