Search
properIvoryPike
@CoachCompanion
@jsxImportSource https://esm.sh/react@18.2.0
HTTP
import { marked } from "https://esm.sh/marked@4.3.0";
function ConfirmationModal({ isOpen, onClose }) {
if (!isOpen) return null;
</div>
function App() {
const [sport, setSport] = useState("");
</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(`
testUrlConstructionVal
@willthereader
// File: testUrlConstructionVal.js in Val Town (Named: @username.testUrlConstructionVal)
Script
// File: testUrlConstructionVal.js in Val Town (Named: @username.testUrlConstructionVal)
export const testUrlConstructionVal = (async () => {
// Reference the function from the other Val
// Example input
const order = ["created_at DESC", "id DESC"]; // Sorting order for comments
const timestamp = "2024-01-19T17:00:00.000Z"; // Filtering criteria
const page = 1; // Page number to fetch
// Invoke the function from the other Val
const constructedUrl = ConstructReadTangleUrl2(timestamp);
logMessage("debug", `Constructed URL: ${constructedUrl}`);

zod_demo_frontend
@stevekrouse
@jsxImportSource https://esm.sh/react
Script
import { createRoot } from "https://esm.sh/react-dom/client";
import type { User } from "./zod_demo_shared";
export function App() {
const [user, setUser] = useState<User>({ username: "", email: "", age: 0 });
const [errors, setErrors] = useState<Partial<User>>({});
api400
@matthamlin
An interactive, runnable TypeScript val by matthamlin
Script
export function api400(req: express.Request, res: express.Response) {
res.status(400);
res.json({
dailyStandupBot
@re757575
Daily Standup Bot Every weekday at 9am EDT send a message to our team's #engineering Discord channel to start a thread to remind us to do our standup. Slack version: @mikker/dailySlackRoundup
Cron
import { discordWebhook } from "https://esm.town/v/stevekrouse/discordWebhook";
export default async function() {
discordWebhook({
url: Deno.env.get("engDiscord"),
valentine
@Moon1ight
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
"Yes",
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(
postHogAPICapture
@ianvph
An interactive, runnable TypeScript val by ianvph
Script
import { fetch } from "https://esm.town/v/std/fetch";
export async function postHogAPICapture({ key, event, properties, distinct_id }: {
key: string;
event: string;
val_p59qHpYGxC
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export default async function handler(req) {
try {
const result = await (async () => {
function isPrime(num) {
if (num <= 1) return false;
return true;
function findLowestThreeDigitPrime() {
for (let num = 100; num < 1000; num++) {
robPikeIO
@peterqliu
robpike.io A re-implementation of https://robpike.io/
HTTP
const msg = new TextEncoder().encode("ssss");
const initialDelay = 20;
export default async function(req: Request): Promise<Response> {
let timerId: number | undefined;
const body = new ReadableStream({
start(controller) {
let currentDelay = initialDelay;
function writeToStream() {
currentDelay *= 1.03;
controller.enqueue(msg);

fetchProxy
@ridge
// intended for GET requests to bypass some CORS problems.
Script
import { fetch } from "https://esm.town/v/std/fetch";
// intended for GET requests to bypass some CORS problems.
export async function fetchProxy(url) {
let response = await fetch(url);
return response.ok ? response.text() : "";
receive_email
@andreterron
An interactive, runnable TypeScript val by andreterron
Script
import { extractData } from "https://esm.town/v/andreterron/extractData";
import { saveToAirtable } from "https://esm.town/v/andreterron/saveToAirtable";
export async function receive_email(email: Email) {
console.log(JSON.stringify(email, null, 2));
const data = await extractData(email);
faviconGenerator
@iamseeley
// This approach will use the fal.ai API to generate a custom favicon based on a user-provided prompt.
HTTP
import { createRoot } from "https://esm.sh/react-dom/client";
function App() {
const [prompt, setPrompt] = useState("");
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
client();
async function generateImage(prompt: string) {
const FAL_KEY = Deno.env.get("FAL_KEY");
return data.images[0].url;
export default async function server(request: Request): Promise<Response> {
const url = new URL(request.url);
playMeASong
@dthyresson
Play me a song Search and if we find it, it'll open the song in Spotify! Feeling Lucky? Play a random song . Like a band? Play one of their tracks.
HTTP
is_hidden: integer("is_hidden", { mode: "boolean" }),
async function getSongCatalog() {
return await db.select().from(tracks).where(not(tracks.is_hidden)).orderBy(tracks.artist, tracks.title);
async function getRecentSearches() {
return await db.select().from(favoriteSongSearches).where(not(favoriteSongSearches.is_hidden)).orderBy(
desc(favoriteSongSearches.id),
async function getArtists() {
return await db.selectDistinct({ artist: tracks.artist }).from(tracks).where(not(tracks.is_hidden)).orderBy(
inventiveVioletDinosaur
@drew_kuhn
With our data designed, let’s build the email! Val Town makes this super easy since it provides a robust email package. The package exports a function by the same name (email) which consumes an object. When called with properly formatted parameters, an email will be sent to the address associated with your Val Town account. “Good” emails need some kind of hook to draw the reader’s attention. What better hook than our joke’s setup? Add an email() function call to your Val which sends an email with the setup as its subject and the punchline as its body text. import { email } from "https://esm.town/v/std/email?v=9"; // Fetches a random joke.
function fetchRandomJoke() {
const SAMPLE_JOKE = {
"setup": "What do you call a group of disorganized cats?",
"punchline": "A cat-tastrophe.",
};
return SAMPLE_JOKE;
} const randomJoke = fetchRandomJoke();
const setup = randomJoke.setup;
const punchline = randomJoke.punchline; // Sends an email with the joke.
export const emailRandomJoke = email({
text: punchline,
subject: setup,
});
Notice that this data is being passed in as key-value pairs since it is inside of an object. There is only one parameter (that object) passed into the function. Save and evaluate your val by clicking the “Run” button at the top right.
Script
With our data designed, let’s build the email! Val Town makes this super easy since it provides a robust email package. The package exports a function by the same name (email) which consumes an object. When called with properly formatted parameters, an email will be sent to the address associated with your Val Town account.
“Good” emails need some kind of hook to draw the reader’s attention. What better hook than our joke’s setup? Add an email() function call to your Val which sends an email with the setup as its subject and the punchline as its body text.
import { email } from "https://esm.town/v/std/email?v=9";
// Fetches a random joke.
function fetchRandomJoke() {
const SAMPLE_JOKE = {
subject: setup,
Notice that this data is being passed in as key-value pairs since it is inside of an object. There is only one parameter (that object) passed into the function.
Save and evaluate your val by clicking the “Run” button at the top right.
// Fetches a random joke.
async function fetchRandomJoke() {
const response = await fetch(

githubNotification
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Cron
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
import { email } from "https://esm.town/v/std/email?v=11";
export async function githubNotification({ lastRunAt }) {
let events = (
await fetchJSON(