Search

Results include substring matches and semantically similar vals. Learn more
hbcoop avatar
linkInBioTemplate
@hbcoop
@jsxImportSource https://esm.sh/react@17.0.2
HTTP
transition: "all 0.3s ease",
boxShadow: "0 4px 6px rgba(0, 0, 0, 0.1)",
export default async function handler(req: Request): Promise<Response> {
const html = renderToString(
<html>
stevekrouse avatar
preciseAquamarineReptile
@stevekrouse
@jsxImportSource https://esm.sh/react
HTTP
import { tomorrow } from "https://esm.sh/react-syntax-highlighter/dist/esm/styles/prism";
function App() {
const [prompt, setPrompt] = useState("hello llamapalooza");
useEffect(() => {
function handleKeyDown(e: KeyboardEvent) {
if (e.key === "ArrowLeft" && currentIndex > 0) {
}, [currentIndex, history]);
async function handleSubmit(e: React.FormEvent) {
e.preventDefault();
</div>
function client() {
createRoot(document.getElementById("root")!).render(<App />);
client();
function extractCodeFromFence(text: string): string {
const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
return htmlMatch ? htmlMatch[1].trim() : text;
export default async function server(req: Request): Promise<Response> {
if (req.method === "POST") {
rdimartino avatar
notehub
@rdimartino
Notehub A set of helper functions for interacting with the Notehub API Requires NOTEHUB_CLIENT_ID and NOTEHUB_CLIENT_SECRET environment variables to be configured.
Script
# Notehub
A set of helper functions for interacting with the Notehub API
Requires `NOTEHUB_CLIENT_ID` and `NOTEHUB_CLIENT_SECRET` [environment variables](https://www.val.town/settings/environment-va
AyaMekki8 avatar
Translation_Trends_Monitor_2025
@AyaMekki8
@jsxImportSource https://esm.sh/react@18.2.0
HTTP
proficiencyLevel: 'Entry' | 'Intermediate' | 'Advanced' | 'Expert';
function TranslationSkillsDashboard() {
const [skills, setSkills] = useState<SkillTrend[]>([]);
useEffect(() => {
async function fetchSkillTrends() {
try {
</div>
function client() {
createRoot(document.getElementById("root")).render(<TranslationSkillsDashboard />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request): Promise<Response> {
if (new URL(request.url).pathname === '/skill-trends') {
try {
const { OpenAI } = await import("https://esm.town/v/std/openai");
const openai = new OpenAI();
// Process skills sequentially to avoid rate limiting
// Try to generate AI definition with exponential backoff
const definitionResponse = await openai.chat.completions.create({
messages: [{
zackoverflow avatar
lisp
@zackoverflow
Lispaas (lisp as a service) A mini lisp interpreter How to use: To execute code: const result = @zackoverflow.lisp(" (+ 1 2)") To just parse and return the AST: const ast = @zackoverflow.lisp("(+ 1 2)", true) The value returned is the last expression of the program, for example: const lispResult = @zackoverflow.lisp("(+ 1 2) (+ 400 20)") console.log('Val', lispResult.val === 420) Example: Compute Fibonacci sequence let result = @zackoverflow.lisp(` (defun fib (x) (if (<= x 1) x (defun impl (i n-1 n-2) (if (= x i) (+ n-1 n-2) (impl (+ i 1) (+ n-1 n-2) n-1))) (impl 2 1 0))) (assert-eq 0 (fib 0)) (assert-eq 1 (fib 1)) (assert-eq 1 (fib 2)) (assert-eq 2 (fib 3)) (assert-eq 3 (fib 4)) (assert-eq 5 (fib 5)) (assert-eq 8 (fib 6)) (assert-eq 13 (fib 7)) `); Documentation Functions You can define a function like so: (defun hello (x) (print x)) Rest/variadic arguments are also supported (defun variable-amount-of-args (...args) (print args)) (variable-amount-of-args "Hello" "World!") Lists Define a list like so: (let ((my-list (list 1 2 3 4))) (print my-list) (print (list-get my-list 1))) Internally, a list is just a Javascript array. So indexing is O(1), but that does mean cdr requires copying (vs the linked list implementation). Plists Property lists, or records. Internally these are Javascript objects. Create a plist like so: (set null :key "Value") TODO
Script
#### Functions
You can define a function like so:
function parseAstExpr(): AstExpr | undefined {
function parseApply(): AstExpr | undefined {
function parseSym(char: string): string | undefined {
function parseString(char: string): string | undefined {
function parseNumber(char: string): number | undefined {
function eatWhitspace() {
function isWhitespace(char: string): boolean {
function evaluate(env: Env, expr: AstExpr): LispValue {
function evaluateLambdaWithValues(lambdaEnv: Env, fn: {
function lispValToExpr(val: LispValue): AstExpr {
rodrigotello avatar
FunctionToHTMLForm
@rodrigotello
An interactive, runnable TypeScript val by rodrigotello
Script
import { valForm } from "https://esm.town/v/rodrigotello/valForm";
import { multiplicationFunctionTest } from "https://esm.town/v/rodrigotello/multiplicationFunctionTest";
export async function FunctionToHTMLForm(
req: express.Request,
res: express.Response,
let myFunctionValAsHTML = multiplicationFunctionTest; // Insert your function here and it should generate an HTML form
return res.send(`${valForm(myFunctionValAsHTML)}`);
dhvanil avatar
val_aVQs45AhGk
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export default async function handler(req) {
try {
const result = await (async () => {
andreterron avatar
references
@andreterron
An interactive, runnable TypeScript val by andreterron
Script
import { searchParams } from "https://esm.town/v/stevekrouse/searchParams?v=9";
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
export async function references({ token, since, until, offset, limit }: {
token: string;
since?: Date;
vawogbemi avatar
reqEvaltown
@vawogbemi
An interactive, runnable TypeScript val by vawogbemi
HTTP
import net, { AddressInfo } from "node:net";
export default async function(req: Request): Promise<Response> {
return serveRequest(
encodeURIComponent(`
export default async function(req: Request): Promise<Response> {
return Response.json("I am within a worker!")
export async function serveRequest(req: Request, importUrl: string): Promise<Response> {
let port = await getFreePort();
resolve(port);
export async function isPortListening(port: number): Promise<boolean> {
let isListening = false;
skhomes avatar
SKHomesTenantManagement
@skhomes
@jsxImportSource https://esm.sh/react@18.2.0
HTTP
import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
// [Previous code remains unchanged]
export default async function server(request: Request): Promise<Response> {
const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
const KEY = new URL(import.meta.url).pathname.split("/").at(-1);
const SCHEMA_VERSION = 3;
// CSS definition moved inside the server function
const css = `
body {
dbcooper avatar
measureValTownE2e
@dbcooper
// E.g. from a user's perspective (not the real execution time!)
Script
userFuncTimes.push(Date.now() - start);
console.log(
`average e2e user function time: ${(
userFuncTimes.reduce((a, b) => a + b, 0) / count
).toFixed(0)}ms (fastest was ${userFuncTimes
jackc avatar
manifold_daily_loan_collector
@jackc
Runs daily to collect your Manifold loan! Instructions: Fork this Val. Get your Manifold API key from your profile . Add manifoldApiKey with your key to the Val Environment Variables . Hit run! It will run daily to collect your loans.
Cron
export default async function() {
const res = await fetch("https://api.manifold.markets/request-loan", {
headers: {
ianvph avatar
captureCalendlyWebhook
@ianvph
An interactive, runnable TypeScript val by ianvph
Script
import process from "node:process";
import { capturePostHogEvent } from "https://esm.town/v/ianvph/capturePostHogEvent";
export async function captureCalendlyWebhook(req: Request) {
let reqJson = await req.json();
console.log(reqJson);
neverstew avatar
webHTMLExample
@neverstew
// View at https://neverstew-webHTMLExample.web.val.run?name=Steve
HTTP
// View at https://neverstew-webHTMLExample.web.val.run?name=Steve
export async function webHTMLExample(req: Request) {
const query = new URL(req.url).searchParams;
return new Response(
ashokpds15 avatar
cerebrascoderWebApp
@ashokpds15
An interactive, runnable TypeScript val by ashokpds15
HTTP
export default async function server(request: Request): Promise<Response> {
return new Response(`
<!DOCTYPE html>