Search

Results include substring matches and semantically similar vals. Learn more
jdan avatar
dialog
@jdan
dialog Renders windows 98 dialog boxes as SVGs. Using satori and styles from 98.css Usage https://jdan-dialog.web.val.run/? w =200& h =110& title =Hello& caption =World w (default: 200): the width of the dialog h (default: 110): the height of the dialog title (default: "{title}"): the text in the title bar caption (default: "{caption}"): the caption text
HTTP
/** @jsxImportSource https://esm.sh/react */
import { renderToString } from "npm:react-dom/server";
import { Hono } from "npm:hono";
import satori from "npm:satori";
stevekrouse avatar
infoboxCrawler
@stevekrouse
@jsxImportSource https://esm.sh/react
HTTP
/** @jsxImportSource https://esm.sh/react */
import cheerio from "https://esm.sh/cheerio@1.0.0-rc.12";
import cytoscape from "https://esm.sh/cytoscape@3.23.0";
import React, { useEffect, useRef, useState } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
cytoscape.use(dagre);
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") {
client();
async function server(req: Request): Promise<Response> {
yawnxyz avatar
threeJsTorus
@yawnxyz
playing around with townie during a meeting >.>
HTTP
// This approach creates an interactive 3D scene using Three.js to display particles in a rotating donut shape.
// The scene is rendered client-side using WebGL.
export default async function server(request: Request): Promise<Response> {
previousMousePosition = {
x: event.clientX,
y: event.clientY
function onMouseMove(event) {
const deltaMove = {
x: event.clientX - previousMousePosition.x,
y: event.clientY - previousMousePosition.y
instancedMesh.rotation.y += deltaMove.x * 0.005;
instancedMesh.rotation.x += deltaMove.y * 0.005;
previousMousePosition = { x: event.clientX, y: event.clientY };
function onMouseUp(event) {
veddevv avatar
snakeclone
@veddevv
Snake clone with effects.
HTTP
/** @jsxImportSource https://esm.sh/react */
import React, { useState, useEffect, useRef } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
const CANVAS_SIZE = 400;
liamdanielduffy avatar
selfEmbeddedNoFramework
@liamdanielduffy
// https://www.val.town/embed/liamdanielduffy.selfEmbedded
Script
function initResize(e) {
startX = e.clientX;
startY = e.clientY;
startWidth = parseInt(document.defaultView.getComputedStyle(element).width, 10);
function resize(e) {
const width = startWidth + e.clientX - startX;
const height = startHeight + e.clientY - startY;
element.style.width = width + 'px';
e.preventDefault();
let startY = e.clientY;
const startTop = parseInt(document.defaultView.getComputedStyle(element).top, 10);
function drag(e) {
const deltaY = e.clientY - startY;
const newTop = startTop + deltaY;
moe avatar
numbergame
@moe
@jsxImportSource https://esm.sh/react
HTTP
/** @jsxImportSource https://esm.sh/react */
import React, { useEffect, useRef, useState } from "https://esm.sh/react"
import { createRoot } from "https://esm.sh/react-dom/client"
// Game board size
setSelectedCells([[row, col]])
const handleTouchMove = (e: React.TouchEvent) => {
if (!isDragging || !boardRef.current) return
const board = boardRef.current
const rect = board.getBoundingClientRect()
const x = touch.clientX - rect.left
const y = touch.clientY - rect.top
const cellSize = rect.width / BOARD_SIZE
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />)
if (typeof document !== "undefined") { client() }
async function server(request: Request): Promise<Response> {
liamdanielduffy avatar
reactTodoListWebsite
@liamdanielduffy
// https://api.val.town/v1/express/liamdanielduffy.reactTodoListWebsite
Script
import { REACT_TODO_LIST_CONTENTS } from "https://esm.town/v/liamdanielduffy/REACT_TODO_LIST_CONTENTS";
import { addReactFromValCDN } from "https://esm.town/v/liamdanielduffy/addReactFromValCDN";
import { buildHtml } from "https://esm.town/v/liamdanielduffy/buildHtml";
// https://api.val.town/v1/express/liamdanielduffy.reactTodoListWebsite
export function reactTodoListWebsite(req, res) {
res.set("Content-Type", "text/html");
res.send(buildHtml({
scripts: [addReactFromValCDN()],
styles: REACT_TODO_LIST_CONTENTS.styles,
body: REACT_TODO_LIST_CONTENTS.body,
roramigator avatar
moodTracker
@roramigator
// This mood tracker will use a GitHub-like contribution table to visualize mood entries.
HTTP
// The dashboard will display the contribution table and some basic stats.
/** @jsxImportSource https://esm.sh/react */
import React, { useState, useEffect } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
const MOODS = ["πŸ˜„", "😊", "😐", "πŸ˜•", "😒"];
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
async function server(request: Request): Promise<Response> {
kaz avatar
reluctantCoffeeGayal
@kaz
* This app implements a "Would You Rather" game with a ranking system for answers and a progress bar. * It uses React for the frontend and SQLite for persistent storage on the backend. * The ranking system updates based on user choices and displays in the Answers tab. * A progress bar is added to show completion of 20 questions.
HTTP
* This app implements a "Would You Rather" game with a ranking system for answers and a progress bar.
* It uses React for the frontend and SQLite for persistent storage on the backend.
* The ranking system updates based on user choices and displays in the Answers tab.
* A progress bar is added to show completion of 20 questions.
/** @jsxImportSource https://esm.sh/react */
import React, { useCallback, useEffect, useState } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
import {
useNavigate,
} from "https://esm.sh/react-router-dom";
// Types
const [username, setUsername] = useState("");
const handleLogin = useCallback(async (e: React.FormEvent) => {
e.preventDefault();
</div>
function client() {
createRoot(document.getElementById("root")!).render(<App />);
if (typeof document !== "undefined") {
client();
async function server(request: Request): Promise<Response> {
stevekrouse avatar
blobCommentsReact
@stevekrouse
@jsxImportSource https://esm.sh/react
HTTP (deprecated)
/** @jsxImportSource https://esm.sh/react */
import { Hono } from "https://esm.sh/hono";
import React, { useEffect, useState } from "https://esm.sh/react";
import { hydrateRoot } from "https://esm.sh/react-dom/client";
import { renderToReadableStream } from "https://esm.sh/react-dom/server";
import { blob } from "https://esm.town/v/std/blob?v=10";
sharanbabu avatar
textSummarizationComparisonTool
@sharanbabu
* This val creates a text summarization comparison tool using the Cerebras LLM API. * It provides a text area with default text, a summarize button, and displays two different summarization results: * 1. Direct summarization * 2. Extractive summarization followed by cohesive rewriting * * The server handles API calls to Cerebras, while the client manages the UI and user interactions.
HTTP
* The server handles API calls to Cerebras, while the client manages the UI and user interactions.
/** @jsxImportSource https://esm.sh/react */
import React, { useEffect, useState } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
function client() {
client();
const client = new Cerebras({ apiKey: Deno.env.get("CEREBRAS_API_KEY") });
const summary1Response = await client.chat.completions.create({
const extractiveResponse = await client.chat.completions.create({
const summary2Response = await client.chat.completions.create({
arash2060 avatar
VALLErun
@arash2060
The actual code for VALL-E: https://www.val.town/v/janpaul123/VALLE
HTTP (deprecated)
/** @jsxImportSource https://esm.sh/react */
import { renderToString } from "npm:react-dom/server";
consider it part of the current conversation. The conversation below is your recent interaction with the user.
You can use React but you don't have to.
currentCode = `/** @jsxImportSource https://esm.sh/react */
import React from "npm:react";
import { renderToString } from "npm:react-dom/server";
You can use React but you don't have to.
DON'T respond with a preamble (aside from saying "Certainly", "Of course", "Let's do it", or something similar) or further ex
/** @jsxImportSource https://esm.sh/react */
cofsana avatar
multirouteHono
@cofsana
🌐 Multi-Route Website with Hono
HTTP (deprecated)
* This val creates a simple website for Janic Business Group, a business consulting firm.
* It uses React for the frontend and Hono for the backend routing.
* The website includes a home page, about page, and services page.
/** @jsxImportSource https://esm.sh/react */
import React from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
import { Hono } from "https://esm.sh/hono";
function App() {
const [page, setPage] = React.useState('home');
const renderPage = () => {
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
app.get('*', (c) => {
liamdanielduffy avatar
buildReactDomMinified
@liamdanielduffy
An interactive, runnable TypeScript val by liamdanielduffy
Script
import { REACT_DOM_MINIFIED } from "https://esm.town/v/liamdanielduffy/REACT_DOM_MINIFIED";
let { REACT_DOM_MINIFIED_PT4 } = await import("https://esm.town/v/liamdanielduffy/REACT_DOM_MINIFIED_PT4");
let { REACT_DOM_MINIFIED_PT3 } = await import("https://esm.town/v/liamdanielduffy/REACT_DOM_MINIFIED_PT3");
let { REACT_DOM_MINIFIED_PT2 } = await import("https://esm.town/v/liamdanielduffy/REACT_DOM_MINIFIED_PT2");
let { REACT_DOM_MINIFIED_PT1 } = await import("https://esm.town/v/liamdanielduffy/REACT_DOM_MINIFIED_PT1");
export async function buildReactDomMinified() {
"https://unpkg.com/react-dom@18.2.0/umd/react-dom.production.min.js",
REACT_DOM_MINIFIED_PT1 = src.substring(0, pt1End);
REACT_DOM_MINIFIED_PT2 = src.substring(pt1End, pt2End);
REACT_DOM_MINIFIED_PT3 = src.substring(pt2End, pt3End);
yieldray avatar
translate
@yieldray
Translator using a public deepl api
HTTP (deprecated)
<script src="https://cdn.tailwindcss.com/"></script>
<script type="module">
import { html, Component, render } from "https://cdn.cbd.int/htm/preact/standalone.module.js";
import { ofetch } from "https://esm.sh/ofetch/dist/index.mjs";
import { z } from "https://esm.sh/zod";