Search

Results include substring matches and semantically similar vals. Learn more
cufaoil avatar
ToDoes
@cufaoil
An interactive, runnable TypeScript val by cufaoil
HTTP
import { ToDoesList } from "https://esm.town/v/cufaoil/todoeslist";
export function ToDoes() {
return Response.json(ToDoesList);
all avatar
chronosphere
@all
@jsxImportSource https://esm.sh/react
HTTP
return [renderer, renderer.domElement];
function App() {
const canvasRef = useRef(null);
const mouse = new THREE.Vector2();
function onMouseMove(event) {
mouse.x = (event.clientX / window.innerWidth) * 2 - 1;
window.addEventListener("mousemove", onMouseMove, false);
function animate(time) {
requestAnimationFrame(animate);
</div>
function client() {
console.log("Client function called");
const root = document.getElementById("root");
if (typeof document !== "undefined") {
console.log("Document is defined, calling client function");
client();
export default async function server(request: Request): Promise<Response> {
console.log("Server function called");
return new Response(
import { client } from "${import.meta.url}";
console.log("Client imported, calling it");
client();
dthyresson avatar
bedtimeStoryMaker
@dthyresson
Bedtime Story Maker Inspired from a RedwoodJS demo I mde last year, this adds generative art powered by Fal to the bedtime story maker. Start writing a story by picking a style (spooky, colofrol, adventurous an animal (penguin, mouse, unicorn, whale ...) a color for the animal and activity (befriends aliens, goes to the doctor, rides a rollercoaster, bakes a cake for friends) It uses OpenAI to write a children's bedtime story title summary story for a "fantastical story about a green whale who rides the bus" or the "spooky story about the tomato fox who explores a cave". Then using the summary, OpenAI geenrates another prompt to describe the instructions to geneate a childrens story book image. That's sent to Fal to generate an image. Stories get saved to bedtime_stories in SQLite for viewing, searching and maybe sharing. You then get a bedtime story to enjoy!
HTTP
* and activity (befriends aliens, goes to the doctor, rides a rollercoaster, bakes a cake for friends)
It uses OpenAI to write a children's bedtime story
* title
for a "fantastical story about a green whale who rides the bus" or the "spooky story about the tomato fox who explores a cave
Then using the summary, OpenAI geenrates another prompt to describe the instructions to geneate a childrens story book image.
That's sent to Fal to generate an image.
import { ValTownLink } from "https://esm.town/v/dthyresson/viewOnValTownComponent";
import { chat } from "https://esm.town/v/stevekrouse/openai";
import * as fal from "npm:@fal-ai/serverless-client";
const identifier = "bedtime-story-limiter";
async function enforceRateLimit() {
const ratelimit = await unkey.limit(identifier);
const app = new Hono();
function parseStory(text) {
// Split the text into lines and remove empty lines
janpaul123 avatar
valle_tmp_86965239286526150399192188265447
@janpaul123
// This val responds with "Hello World" styled with crazy gradients in CSS
HTTP
// This val responds with "Hello World" styled with crazy gradients in CSS
export default async function main(req: Request): Promise<Response> {
const htmlResponse = `
<html>
madi_singlak avatar
emailRandomJoke
@madi_singlak
// 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",
ae_play avatar
counterTest
@ae_play
An interactive, runnable TypeScript val by ae_play
Script
import { counter } from "https://esm.town/v/ae_play/counter";
import { setCounter } from "https://esm.town/v/ae_play/setCounter";
export function counterTest() {
setCounter(c => c + 1);
console.log(counter);
campsite avatar
email_channel
@campsite
Email a Campsite channel This val creates an email address that posts forwarded emails to a Campsite channel. It uses GPT-4 to extract a readable version of the forwarded email from the raw body. If you don't want to use GPT-4, omit the OPENAI_API_KEY and the raw body will be included in the post. Other providers are available via Vercel's AI SDK . For help with creating integrations, check out the Campsite API docs . You'll need to create an integration and get an API key.
Email
This val creates an email address that posts forwarded emails to a [Campsite](https://campsite.com) channel.
forwarded email from the raw body. If you don't want to use GPT-4, omit the `OPENAI_API_KEY` and the raw body will be include
For help with creating integrations, check out the [Campsite API docs](https://app.campsite.com/campsite/p/notes/campsite-api
import { email } from "https://esm.town/v/std/email";
import { createOpenAI } from "npm:@ai-sdk/openai";
import { generateObject } from "npm:ai";
// https://sdk.vercel.ai/docs/introduction#model-providers
const OPENAI_API_KEY = Deno.env.get("OPENAI_API_KEY");
const campsite = new Campsite({ apiKey: CAMPSITE_API_KEY });
export async function emailValHandler(payload: Email) {
// ignore emails sent to the public val :)
let subject = payload.subject || "Forwarded email (no subject)";
if (OPENAI_API_KEY) {
const openai = createOpenAI({ apiKey: OPENAI_API_KEY });
// Extract name and email from the forwarded message
const { object: { name, email, subject, message } } = await generateObject({
model: openai("gpt-4-turbo"),
schema: z.object({
janpaul123 avatar
valle_tmp_49657916196642669116978402870103
@janpaul123
// This val will respond to any request with an HTML "Hello, world!" message styled with some fun CSS
HTTP
// This val will respond to any request with an HTML "Hello, world!" message styled with some fun CSS
export default async function(req: Request): Promise<Response> {
const html = `
<html>
Aayushmk avatar
valentine
@Aayushmk
Hello!!! Feel free to mess around with this val and make it your own :). Just click on "Fork" in the top right. You can change the phrases that show up as you click no, you can change the firstImg and secondImg, maybe even add more images. And you can also change the colors and any of the text on the screen! Have fun with it and hopefully your crush says yes hehe.
HTTP
"Haha! no is not an option Bebs!!",
function App() {
const [noClicks, setNoClicks] = useState(0);
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request): Promise<Response> {
return new Response(
politelyinvinciblepointer avatar
getmiraclechildcounter
@politelyinvinciblepointer
An interactive, runnable TypeScript val by politelyinvinciblepointer
Script
import { miraclechildcounter } from "https://esm.town/v/politelyinvinciblepointer/miraclechildcounter";
export function getmiraclechildcounter() {
return miraclechildcounter;
tymeee avatar
CS1200
@tymeee
// Fetches a random joke.
Cron
// Fetches a random joke.
// Fetches a random joke.
async function fetchRandomJoke() {
const response = await fetch(
"https://official-joke-api.appspot.com/random_joke",
stevekrouse avatar
browserbaseUtils
@stevekrouse
Utils to loadPageContent() and screenshotPage() . Browserbase Browserbase offers a reliable, high performance serverless developer platform to run, manage, and monitor headless browsers at scale. Leverage our infrastructure to power your web automation and AI agents. Get started with Browserbase for free here . If you have any questions, reach out to developer@browserbase.com.
Script
export interface LoadPageContentOptions {
textContent: boolean;
export async function loadPageContent(url: string, options: LoadPageContentOptions = { textContent: false }) {
const browser = await puppeteer.connect({
browserWSEndpoint: `wss://connect.browserbase.com?apiKey=${Deno.env.get("BROWSERBASE_API_KEY")}`,
export interface ScreenshotPageOptions {
fullPage: boolean;
export async function screenshotPage(url: string, options: ScreenshotPageOptions = { fullPage: true }) {
const browser = await puppeteer.connect({
browserWSEndpoint: `wss://connect.browserbase.com?apiKey=${Deno.env.get("BROWSERBASE_API_KEY")}`,
Astroth1984 avatar
Desi_Effect
@Astroth1984
Hello!!! Feel free to mess around with this val and make it your own :). Just click on "Fork" in the top right. You can change the phrases that show up as you click no, you can change the firstImg and secondImg, maybe even add more images. And you can also change the colors and any of the text on the screen! Have fun with it and hopefully your crush says yes hehe.
HTTP
"https://media.tenor.com/auuEl8q7z44AAAAM/sad-cat-pizza.gif",
function App() {
const [noClicks, setNoClicks] = useState(0);
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request): Promise<Response> {
return new Response(
camflan avatar
echo_request
@camflan
An interactive, runnable TypeScript val by camflan
HTTP
export default async function(req: Request): Promise<Response> {
return Response.json({
success: true,
arfan avatar
tasks_test1
@arfan
@jsxImportSource https://esm.sh/react@18.2.0
HTTP
const SCHEMA_VERSION = 1;
function TaskManager() {
const [tasks, setTasks] = React.useState([]);
</div>
function App() {
return (
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
client();
export default async function server(request: Request): Promise<Response> {
const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");