Search

Results include substring matches and semantically similar vals. Learn more
dhvanil avatar
val_baxJyb52GU
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_baxJyb52GU(req) {
try {
// Execute the code directly and capture its result
const result = await (async () => {
// Test for spatial coordinate anomalies and movement quantization
const testSpatialAnomalies = () => {
// Test diagonal movement precision
const calculateDiagonal = (x1, y1, x2, y2) => {
const dx = x2 - x1;
const dy = y2 - y1;
dhvanil avatar
val_DyfUOZ6tYg
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_DyfUOZ6tYg(req) {
try {
// Execute the code directly and capture its result
const result = await (async () => {
const analyzeRandomness = (data) => {
const mean = data.reduce((acc, val) => acc + val, 0) / data.length;
const variance = data.reduce((acc, val) => acc + Math.pow(val - mean, 2), 0) / data.length;
return { mean, variance };
const randomNumbers = [0.1007, 0.097, 0.1022, 0.0977, 0.1025, 0.0985, 0.0999, 0.0992, 0.1012, 0.1011];
return analyzeRandomness(randomNumbers);
janpaul123 avatar
valle_tmp_844616171781054708454357985212124
@janpaul123
// This val responds with an HTML page styled with funky CSS gradients
HTTP
// This val responds with an HTML page styled with funky CSS gradients
export default async function main(req: Request): Promise<Response> {
const htmlContent = `
<html>
<head>
<style>
body {
background: linear-gradient(to right, #f12711, #f5af19);
font-family: Arial, sans-serif;
text-align: center;
dhvanil avatar
val_idCyDeeEA6
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_idCyDeeEA6(req) {
try {
// Execute the code directly and capture its result
const result = await (async () => {
const checkSumAndSquares = (a, b) => {
const sum = a + b;
const sumOfSquares = a * a + b * b;
return sum === sumOfSquares;
// Test the function with some values
const results = [];
dhvanil avatar
val_w1RxWevh7s
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export default async function handler(req) {
try {
const result = await (async () => {
return 100;
return Response.json({ success: true, result });
} catch (error) {
return Response.json({
success: false,
error: error.message
}, { status: 500 });
janpaul123 avatar
valle_tmp_888865450629273105329300182726127
@janpaul123
// Initialize SQLite database and comments table if it doesn't exist
HTTP
// Initialize SQLite database and comments table if it doesn't exist
const initDB = async () => {
await sqlite.execute(`
CREATE TABLE IF NOT EXISTS comments (
id INTEGER PRIMARY KEY AUTOINCREMENT,
text TEXT NOT NULL,
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP
await initDB();
const app = new Hono();
// Serves the comment page
dhvanil avatar
val_aA8OVTddq9
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export default async function handler(req) {
try {
const result = await (async () => {
return 100;
return Response.json({ success: true, result });
} catch (error) {
return Response.json({
success: false,
error: error.message
}, { status: 500 });
iamseeley avatar
eventListeners
@iamseeley
An interactive, runnable TypeScript val by iamseeley
Script
document.addEventListener('DOMContentLoaded', () => {
const helloResumeElement = document.getElementById('helloResume');
const helloResumeText = "hello, resume";
const timeElement = document.getElementById('localTime');
create3DEmoji('❤️', 24, 24);
currentTime(timeElement);
typeWriter(helloResumeElement, helloResumeText, () => {flashBorder(helloResumeElement);});
const initialDelay = 1000; // Initial delay of 1000 milliseconds
const contentParagraphs = document.querySelectorAll('.content p');
const calloutContainer = document.querySelector('.callout-container');
janpaul123 avatar
valle_tmp_24901011813828427349436434809345
@janpaul123
// This val responds with an HTML form styled with fun CSS to input the user's name and greets them upon form submission
HTTP
// This val responds with an HTML form styled with fun CSS to input the user's name and greets them upon form submission
export default async function(req: Request): Promise<Response> {
if (req.method === "POST") {
const formData = new URLSearchParams(await req.text());
const name = formData.get("name") || "stranger";
const greeting = `Hello, ${name}!`;
const funFact = "Did you know that the first email was sent in 1971?";
const htmlResponse = `
<style>
body {
dhvanil avatar
val_qWElt2jpTu
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export default async function handler(req) {
try {
const result = await (async () => {
return 100;
return Response.json({ success: true, result });
} catch (error) {
return Response.json({
success: false,
error: error.message
}, { status: 500 });
dhvanil avatar
val_80sL9x3ODx
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_80sL9x3ODx(req) {
try {
// Ensure request body is consumed
const body = await req.text();
// Create a function from the provided code and execute it
const userFunction = async () => {
const findPrimes = (n) => {
const primes = [];
for (let i = 2; i < n; i++) {
let isPrime = true;
jeffreyyoung avatar
specialBlueGopher
@jeffreyyoung
An interactive, runnable TypeScript val by jeffreyyoung
HTTP
const replicate = new Replicate({
auth: Deno.env.get("REPLICATE_API_KEY"),
export default serve({
async *handleMessage(req) {
const lastMsg = req.query.at(-1);
const imgUrl = lastMsg?.attachments?.at?.(0)?.url;
const maskUrl = lastMsg?.attachments?.at?.(1)?.url;
const prompt = lastMsg?.content?.trim();
if (!imgUrl || !maskUrl || !prompt) {
yield "Please include a prompt, an image and a mask";
elliotbraem avatar
scheduler
@elliotbraem
An interactive, runnable TypeScript val by elliotbraem
HTTP
export default async function server(request: Request): Promise<Response> {
const SCHEMA_VERSION = 15; // Increment this to create new tables
const KEY = new URL(import.meta.url).pathname.split("/").at(-1);
await sqlite.execute(`
CREATE TABLE IF NOT EXISTS ${KEY}_calendars_${SCHEMA_VERSION} (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT,
creator TEXT,
start_day INTEGER,
end_day INTEGER,
dhvanil avatar
web_9t1xAJu6Te
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function web_9t1xAJu6Te(req) {
return new Response(`<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Seven Cheese Symphony Pizza</title>
<style>
body {
font-family: 'Arial', sans-serif;
maxm avatar
test_explorer_router
@maxm
@jsxImportSource npm:hono/jsx
Script
/** @jsxImportSource npm:hono/jsx */
createHistory,
type HistoryEntry,
readHistory,
writeHistory,
} from "https://esm.town/v/pomdtr/test_explorer_history";
const router = new Hono();
const me = await api("/v1/me", { authenticated: true });
const author = me.username;
router.get("/", async (c) => {