Search

Results include substring matches and semantically similar vals. Learn more
janpaul123 avatar
valle_tmp_58806573259542467349524666831762
@janpaul123
// Response with a silly HTML page with crazy CSS and gradients
HTTP
// Response with a silly HTML page with crazy CSS and gradients
export default async function(req: Request): Promise<Response> {
const html = `
<html>
Afaaques12 avatar
dynamicBronzeOx
@Afaaques12
@jsxImportSource https://esm.sh/react@18.2.0
HTTP
"Straight line: Practical, logical mindset"
function PalmistryApp() {
const [selectedLine, setSelectedLine] = useState(null);
</div>
function client() {
createRoot(document.getElementById("root")).render(<PalmistryApp />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request): Promise<Response> {
return new Response(`
arfan avatar
zARCHIVE_html_Pages
@arfan
// Shared HTML components
HTTP
function getPageHeader(pageTitle: string) {
function getPageFooter() {
async function handleHomePage() {
function handleAboutPage() {
function handleContactPage() {
function handleLocationPage() {
function handleHelpPage() {
<p id="faq-answer-1">Val Town is a platform for creating and sharing JavaScript functions and applications.</p>
async function handleMessageSubmission(request: Request) {
function handleTimeApi() {
apitman avatar
lastlogindemo
@apitman
An interactive, runnable TypeScript val by apitman
HTTP
doAuth(btn.dataset.provider);
function doAuth(provider) {
const params = new URLSearchParams();
// Parses JWT without verifying signature. Must be used over HTTPS
function parseJwt(jwtText) {
const jwtParts = jwtText.split('.');
</html>
export default async function(req: Request): Promise<Response> {
return new Response(html, {
zooi avatar
createQr
@zooi
An interactive, runnable TypeScript val by zooi
Script
export async function createQr(url) {
const qrcode = await import("npm:qrcode");
return await qrcode.toDataURL(url);
acmu avatar
myApiDelete
@acmu
An interactive, runnable TypeScript val by acmu
Script
import { set } from "https://esm.town/v/std/set?v=11";
let { nameList } = await import("https://esm.town/v/acmu/nameList");
export async function myApiDelete(name) {
if (Array.isArray(nameList)) {
nameList = nameList.filter((i) => i !== name);
easrng avatar
generateKeys
@easrng
An interactive, runnable TypeScript val by easrng
Script
import { Buffer } from "node:buffer";
export async function generateKeys() {
const { default: nacl } = await import("npm:tweetnacl@1.0.3");
const keyPair = nacl.sign.keyPair();
vawogbemi avatar
whoIsHiringHome
@vawogbemi
@jsxImportSource https://esm.sh/react
Script
/** @jsxImportSource https://esm.sh/react */
import { Dispatch } from "https://esm.sh/react";
export default function Home(
dispatch: Dispatch<{
type: string;
jdan avatar
latLngOfCity
@jdan
An interactive, runnable TypeScript val by jdan
Script
import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=6";
import { load } from "npm:cheerio";
export async function latLngOfCity(args: { cityName: string }) {
const { cityName } = args;
const html = await fetchText(
ellison0421 avatar
emailRandomJoke
@ellison0421
// Fetches a random joke.
Cron
import { email } from "https://esm.town/v/std/email?v=9";
// Fetches a random joke.
async function fetchRandomJoke() {
const response = await fetch(
"https://official-joke-api.appspot.com/random_joke",
mcnew_mitch avatar
proficientTealFrog
@mcnew_mitch
// Fetches a random joke.
Script
import { email } from "https://esm.town/v/std/email?v=9";
// Fetches a random joke.
function fetchRandomJoke() {
const response = await fetch(
"https://official-joke-api.appspot.com/random_joke",
willthereader avatar
jumpchain_infosite
@willthereader
An interactive, runnable TypeScript val by willthereader
HTTP
export default async function (req: Request): Promise<Response> {
return Response.json({ ok: true })
evol avatar
labLoginGetUsers
@evol
An interactive, runnable TypeScript val by evol
HTTP
import * as bcrypt from "https://deno.land/x/bcrypt@v0.4.1/mod.ts";
import { sqlite } from "https://esm.town/v/std/sqlite";
export default async function(req: Request): Promise<Response> {
const TABLE_NAME = "lab_login_users_with_times";
// get status, name, and last_updated cols
charmaine avatar
empatheticBlackClam
@charmaine
This is an AI code assistant powered by Cerebras , running llama3.3-70b. Inspired by Hassan's Llama Coder . Setup Sign up for Cerebras Get a Cerebras API Key Save it in a Val Town environment variable called CEREBRAS_API_KEY
HTTP
numbers.push(i);
function shuffle(array) {
for (let i = array.length - 1; i > 0; i--) {
shuffle(numbers);
function initializeGrid() {
for (let i = 0; i < 50; i++) {
tiles[i].style.transform = '';
function dragTile(event) {
if (draggedTile) {
draggedTile.style.top = `${Math.min(Math.max(event.clientY - dragOffsetY, 0), maxY)}px`;
function dropTile(event) {
if (draggedTile) {
document.removeEventListener('mouseup', dropTile);
function updateBinProgress(binId, minProgress, maxProgress) {
const currentProgress = binContents[binId].progress;
binProgressPercentage.textContent = `${Math.floor(newProgress)}%`;
function updateOverallProgress() {
let totalProgress = 0;
severedModal.style.display = 'block';
function findEmptySpots() {
emptySpots = [];
emptySpots.push({row, col});
function fillEmptySpots() {
if (emptySpots.length > 0) {
tiles.push(newTile);
function enlargeTiles(tileIndex) {
const tiles = grid.children;
pomdtr avatar
circles
@pomdtr
Multiplayer Circles Move circles around. State is synced with the server. Open a window in another tab and watch the circles update as you move them .
HTTP
// await sqlite.execute({ sql: `INSERT INTO draggable_circles VALUES (?, ?, ?)`, args: [c.index, c.x, c.y] });
function parseResultSet<T>(row: ResultSet): T[] {
return row.rows.map((r) => Object.fromEntries(r.map((c, i) => [row.columns[i], c]))) as T[];
return parseResultSet<Circle>(await sqlite.execute("select * from draggable_circles"));
function diffCircles(array1: Circle[], array2: Circle[]): Circle[] {
const changes: Circle[] = [];
const drag = (() => {
function dragstarted() {
d3.select(this).attr("stroke", "black");
function dragged(event, d) {
d3.select(this).raise().attr("cx", d.x = event.x).attr("cy", d.y = event.y);
function dragended() {
const x = d3.select(this).attr("cx");
.on("click", clicked);
function clicked(event, d) {
if (event.defaultPrevented) return; // dragged