Search
linkInBioTemplate
@n8lenahan
@jsxImportSource https://esm.sh/react
HTTP
/** @jsxImportSource https://esm.sh/react */
import { renderToString } from "npm:react-dom/server";
export default async function(req: Request) {
return new Response(
passionateScarletPrawn
@stevekrouse
👕 Shirtgen API Endpoint Shirtgen lets you generate AI-powered t-shirt designs with just a prompt! 🖋️ Choose between the standard "Flux Schnell" model or the enhanced "Pro" model. Perfect for creating unique custom apparel in seconds! 🚀 💡 How it Works Send a POST request to the endpoint with your design prompt. Toggle between Standard and Pro models using the useProModel flag. The AI generates a high-quality t-shirt design based on your prompt. 📥 Expected POST Data {
"prompt": "A retro sunset with palm trees 🌴🌅",
"useProModel": true
}
HTTP
/** @jsxImportSource https://esm.sh/react */
import React, { useState } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
function App() {
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") {
client();
export default async function server(request: Request): Promise<Response> {
preactExample
@tfayyaz
@jsxImportSource https://esm.sh/preact
HTTP
/** @jsxImportSource https://esm.sh/preact */
import ImportCar from "https://esm.town/v/tfayyaz/reactImportCar";
import { render } from "npm:preact-render-to-string";
function Car(props) {
<Car color="blue" />
export const preactExample = (request: Request) =>
new Response(render(<Garage />), {
giftSuggestionApp
@trollishka
@jsxImportSource https://esm.sh/react
HTTP
/** @jsxImportSource https://esm.sh/react */
import React, { useState, useEffect } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
interface Suggestion {
setLoading(false);
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault();
setOpenDropdown(openDropdown === id ? null : id);
const handleSelectChange = (setter: React.Dispatch<React.SetStateAction<string[]>>, values: string[]) => {
setter(values);
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") {
client();
async function searchProduct(query: string): Promise<{ imageUrl: string; productUrl: string } | null> {
echosearch
@juansebsol
@jsxImportSource https://esm.sh/react
HTTP
/** @jsxImportSource https://esm.sh/react */
import { AnimatePresence, motion } from "https://esm.sh/framer-motion";
import React, { useCallback, useEffect, useState } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
const DATA_SOURCES = [
encodeURIComponent(searchQuery)
}+is:issue+state:open&sort=reactions&order=desc&per_page=100`,
const githubData = await githubResponse.json();
url: issue.html_url,
score: issue.reactions.total_count,
source: "github",
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") {
client();
export default async function server(req: Request): Promise<Response> {
example_component
@pomdtr
@jsxImportSource https://esm.sh/react
Script
/** @jsxImportSource https://esm.sh/react */
import { useEffect, useState } from "https://esm.sh/react";
export default function Component() {
useEffect(() => {
console.log("from client");
// Set up an interval to update the textarea every second
Debugging_Guide
@willthereader
@jsxImportSource https://esm.sh/hono@latest/jsx
HTTP
<li>
<h3>Narrow the search space</h3>
<p>""How can I narrow down to the code that could cause this problem?" Tracing through the whole program is not feasible. Instead, consider:
Using your intuition as a starting point. Did you change a function recently? Are there any likely culprits?
Put console.log at significant point of the program so I can see what’s happening. Ideally, I can spot the problematic code is from that. If not, put console.log at places like half way through the code to get closer to the bug.
valwriter
@yawnxyz
Doesn't seem to work on val.town, should work in principle
HTTP
const examples = [
user: "website that shows the current time",
content: `/** @jsxImportSource npm:react */
export default function() {
return <h1>{new Date().toLocaleTimeString()}</h1>;
passionateBeigeButterfly
@stevekrouse
SQLite Explorer View and interact with your Val Town SQLite data. It's based off Steve's excellent SQLite Admin val, adding the ability to run SQLite queries directly in the interface. This new version has a revised UI and that's heavily inspired by LibSQL Studio by invisal . This is now more an SPA, with tables, queries and results showing up on the same page. Install Install the latest stable version (v86) by forking this val: Authentication Login to your SQLite Explorer with password authentication with your Val Town API Token as the password. Todos / Plans [ ] improve error handling [ ] improve table formatting [ ] sticky table headers [x] add codemirror [ ] add loading indication to the run button (initial version shipped) [ ] add ability to favorite queries [ ] add saving of last query run for a table (started) [ ] add visible output for non-query statements [ ] add schema viewing [ ] add refresh to table list sidebar after CREATE/DROP/ALTER statements [ ] add automatic execution of initial select query on double click [x] add views to the sidebar [ ] add triggers to sidebar [ ] add upload from SQL, CSV and JSON [ ] add ability to connect to a non-val town Turso database [x] fix wonky sidebar separator height problem (thanks to @stevekrouse) [x] make result tables scrollable [x] add export to CSV, and JSON (CSV and JSON helper functions written in this val . Thanks to @pomdtr for merging the initial version!) [x] add listener for cmd+enter to submit query
HTTP
- [ ] add schema viewing
- [ ] add refresh to table list sidebar after `CREATE/DROP/ALTER` statements
- [ ] add automatic execution of initial select query on double click
- [x] add views to the sidebar
- [ ] add triggers to sidebar
- [ ] add upload from SQL, CSV and JSON
- [ ] add ability to connect to a non-val town Turso database
- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
- [x] make result tables scrollable
return c.render(
<main class="sidebar-layout">
<div class="sidebar">
<TablesList tables={[...tables, ...views]}></TablesList>
<Separator direction="horizontal"></Separator>
<div class="not-sidebar">
<EditorSection />
preactExample
@iamseeley
@jsxImportSource https://esm.sh/preact
HTTP
/** @jsxImportSource https://esm.sh/preact */
import { render } from "npm:preact-render-to-string";
export const preactExample = (request: Request) =>
new Response(render(<div>Test {1 + 1}</div>), {
notedCoffeeSpider
@Raazx
@jsxImportSource https://esm.sh/react@18.2.0
HTTP
/** @jsxImportSource https://esm.sh/react@18.2.0 **/
import { renderToString } from "https://esm.sh/react-dom@18.2.0/server";
export default (req: Request) => {
return new Response(
excaliVal
@all
[ ] 📄 Templates [x] 🔄 Update Excalidraw JSR Thanks pomdtr ! [ ] 🔗 Sync Excalidraw with Obsidian [ ] 🖼️ Gallery [ ] 📊 Multi Excalidraw
HTTP
/** @jsxImportSource https://esm.sh/react */
import confetti from "https://esm.sh/canvas-confetti@1.6.0";
import React, { useEffect, useState } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
const NAMING_OPTIONS = {
const fireConfetti = (event) => {
const rect = event.target.getBoundingClientRect();
const x = (rect.left + rect.right) / 2 / window.innerWidth;
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") {
client();
export default async function server(request: Request): Promise<Response> {
imggenpro
@andiebuk
Example usage: https://your-val.val.run?image=a%20beautiful%20sunset (uses default 1024x768)
https://your-val.val.run?image=a%20beautiful%20sunset&width=512&height=512 (uses 512x512)
https://your-val.val.run?image=a%20beautiful%20sunset&width=4096&height=4096 (will cap at 2048x2048) This uses together.ai api and generates the image using the black-forest-labs/FLUX.1-schnell model which is very fast. You will need to set the environment var TOGETHER_API_KEY to your key. I built this entirely with Townie AI and most of it was done with the Claude 3.5 Haiku which I find for most projects get things right faster than sonnet.
HTTP
/** @jsxImportSource https://esm.sh/react */
import React, { useState } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
function App() {
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") {
client();
// Utility function to validate and adjust image dimensions
webgen
@thesephist
Made on Val Town livestream. This project is a kind of a mini tribute to Websim . To-dos: Spruce up styles a bit Write this README ~Add a cache!~ ~Try moving style tag to the bottom by prompting so content appears immediately and then becomes styled~ didn't work b/c CSS parsing isn't progressive Need more prompting to get the model not to generate placeholder-y content Better root URL page / index page with links to some good sample generations
HTTP
Your description should include:
- What content is on the page
- Other elements like sidebars, links, images that may be in the page
- The author and origin of the page
- The stylistic aesthetic of the page
weatherAppTR
@fehmi17
@jsxImportSource https://esm.sh/react
HTTP
/** @jsxImportSource https://esm.sh/react */
import React, { useState, useEffect, useCallback, useMemo } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
import { motion, AnimatePresence } from "https://esm.sh/framer-motion";
</motion.div>
function client() {
createRoot(document.getElementById("root")).render(<WeatherApp />);
if (typeof document !== "undefined") { client(); }
export default async function handler(request: Request): Promise<Response> {