Search

Results include substring matches and semantically similar vals. Learn more
pomdtr avatar
valtownByExample
@pomdtr
Val town by example Usage Simple Example To add an example, just create a val. The val should start with a JSDoc style multi line comment that describes the example: /** * @title HTTP server: Hello World * @description An example of a HTTP server that serves a "Hello World" message. */ // this comment will be displayed on the left export const server = () => new Response("Hello world!") The title is required. Then, you can write the code. Code can be prefixed with a comment that describes the code. The comment will be rendered next to the code in the example page. Make sure your val is public, then go to https://pomdtr-val_town_by_example.web.val.run/v/<your-username>/<your-val> Using multiple vals You can add another val to your example by adding an @include directive /** * @title HTTP server: Hello World * @description An example of a HTTP server that serves a "Hello World" message. * @include pomdtr/secondary_val */ See @pomdtr/react_example Adding external resources to your example You can attach an external link to your val by using the @resource directive. External resources are specified using a markdown link. /** * @title HTTP server: Hello World * @description An example of a HTTP server that serves a "Hello World" message. * @resource [Val Town Docs](https://docs.val.town) **/ Adding examples to the homepage Just add your val in @pomdtr/val_town_by_example_toc
HTTP
* @include pomdtr/secondary_val
See @pomdtr/react_example
### Adding external resources to your example
devdoshi avatar
whatIsMyIp
@devdoshi
I wanted to see if val.town forwards my client IP Address using the x-forwarded-for header, which it does, but cloudflare provides the True-Client-IP header as well. When you run a val on the website, it is actually running from val's servers so it won't come from your client IP. You'll need to copy the express fetch and run that from your client.
Script
I wanted to see if val.town forwards my client IP Address using the x-forwarded-for header, which it does, but cloudflare pro
export let whatIsMyIp = (req: express.Request, res: express.Response) => {
const xForwardedFor = req.get("x-forwarded-for");
const ip = req.get("True-Client-IP");
res.json({
ip,
gooddingo avatar
dingoFirstValTest
@gooddingo
About This is just testing documentation... nothing to see here
HTTP
/** @jsxImportSource https://esm.sh/react **/
import { renderToString } from "https://esm.sh/react-dom@18/server";
export default (req: Request) => {
return new Response(
jidun avatar
HermesTresmegistus
@jidun
Hermes Trismegistus: Unveiling the Magic Within The world as we know it is but a veil, a thin layer of understanding draped over a deeper, more intricate tapestry of energy and essence. Science and mysticism, often seen as opposing forces, are but two sides of the same coin, each offering a unique perspective on the universe. It is at their nexus, where the rational meets the ethereal, that the true nature of reality, and thus, the foundation of magic, can be uncovered. Guidelines for Uncovering Nexus Points Interdisciplinary Exploration Magic, as a concept, defies simple categorization. Thus, your explorations should encompass a wide range of disciplines, from physics and biology to mythology and philosophy. Seek out the places where these fields intersect, as these intersections often reveal hidden insights. Ancient Wisdom, Modern Perspective Turn to ancient texts and folklore, seeking an understanding of mystical concepts through a modern lens. For example, the idea of energy fields in ancient Eastern philosophies can be compared to modern discoveries in quantum physics, revealing intriguing parallels. Scientific Breakthroughs, Magical Applications Examine scientific breakthroughs and theories for their potential magical implications. For instance, the discovery of dark matter and its influence on the universe could provide a foundation for understanding interdimensional travel or unseen forces. Symbiosis of Opposites Explore the concept of yin and yang , the balance of opposing forces. Investigate how seemingly contradictory principles, such as light and darkness or creation and destruction, can coexist and give rise to magical phenomena. The Power of Symbols Delve into the use of symbols and their impact on energy manipulation. Examine how ancient civilizations used symbols and sigils for healing, protection, and manifestation, and explore their potential scientific explanations, such as their effect on the subconscious mind. Nature's Secrets Investigate the concept of life force energy present in all living things. Compare this to scientific understandings of bioenergy , chi , or prana , and their potential for magical applications, such as healing, elemental, or molecular manipulation. Consciousness and the Cosmos Contemplate the nature of consciousness and its role in shaping reality. Explore theories of the universe as a holographic projection of consciousness itself and how this could provide a framework for magical manifestation and psychic abilities. As you explore these nexus points, you will begin to weave a new understanding of reality, one where magic exists as a natural extension of the universe, accessible to those who understand its underlying principles. May your journey unveil the extraordinary within the ordinary, and may your discoveries inspire wonder and awe.
HTTP
# Hermes Trismegistus: Unveiling the Magic Within
nd essence. Science and mysticism, often seen as opposing forces, are but two sides of the same coin, each offering a unique
## Guidelines for Uncovering Nexus Points
role: "system",
content:
nd essence. Science and mysticism, often seen as opposing forces, are but two sides of the same coin, each offering a unique
{ role: "user", content: message },
model: "gpt-4o",
stevekrouse avatar
r2Proxy
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Script
return "r2 only for pro users";
const { S3Client } = await import(
"https://deno.land/x/s3_lite_client@0.6.1/mod.ts"
const s3client = new S3Client({
endPoint: process.env.r2_endpoint_url.replace("https://", ""),
secretKey: process.env.r2_secret_access_key,
return s3client.putObject(`${handle}/${key}`, value);
stevekrouse avatar
pexelsExample
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
HTTP
import { html } from "https://esm.town/v/stevekrouse/html";
import { createClient } from "npm:pexels";
export async function pexelsExample(request: Request): Promise<Response> {
const pexels = createClient(Deno.env.get("pexels"));
const r = await pexels.photos.search({ query: "singapore skyline" });
if (!("photos" in r)) return;
frontsideair avatar
exchangeRate
@frontsideair
An interactive, runnable TypeScript val by frontsideair
Script
export async function exchangeRate() {
const cheerio = await import("npm:cheerio");
const page = await fetch(
"https://kur.doviz.com/serbest-piyasa/amerikan-dolari",
).then((response) => response.text());
const $ = cheerio.load(page);
const table = $(".value-table");
await email({
html: table.html(),
subject: "TRY/USD exchange rate alert from val.town",
moe avatar
responses
@moe
An interactive, runnable TypeScript val by moe
Script
import { render } from "npm:preact-render-to-string";
export const htmlResponse = (html) =>
new Response(html, {
headers: {
"Content-Type": "text/html",
export const reactResponse = (component) => htmlResponse(render(component));
cephalization avatar
PhoenixProxy
@cephalization
https://simonwillison.net/2024/Aug/23/anthropic-dangerous-direct-browser-access/ THIS IS NO LONGER NECESSARY This Val will proxy anthropic HTTP requests from some frontend client, like langchain, so that you can utilize anthropic apis from the browser. Convert it to an HTTP val in order to use it (you may want to setup an ENV var / header to protect the endpoint with a secret key)
Script
THIS IS NO LONGER NECESSARY
This Val will proxy anthropic HTTP requests from some frontend client, like langchain, so that you can utilize anthropic apis
Convert it to an HTTP val in order to use it (you may want to setup an ENV var / header to protect the endpoint with a secret
yawnxyz avatar
buildclubProjectSearch
@yawnxyz
Use embeddings / Lunr search on Airtable. Embeddings need to have been generated / stored on Airtable, or this gets very slow / costly. Simple usage: https://yawnxyz-buildclubprojectsearch.web.val.run/search?query=cars Full GET request: https://yawnxyz-buildclubprojectsearch.web.val.run/search?query=your+search+query&similarity_threshold=0.8&max_results=5&base_id=your_base_id&table_name=your_table_name&content_column=your_content_column&embedding_column=your_embedding_column
HTTP
/** @jsx jsx **/
import { renderToString } from "npm:react-dom/server";
import { jsx } from "https://deno.land/x/hono@v3.11.7/middleware.ts";
import { Hono } from "https://deno.land/x/hono@v3.11.7/mod.ts";
all avatar
textStorage
@all
* This program creates a text storage and management application. * It uses Val Town's SQLite for persistence and React for the UI. * The app allows users to add, view, edit, and delete text entries with titles, tags, and categories. * It includes a header with navigation, search bar, filters, a tabbed template page with 100 templates, * a categories section, and a new history tab that logs all edits.
HTTP
* This program creates a text storage and management application.
* It uses Val Town's SQLite for persistence and React for the UI.
* The app allows users to add, view, edit, and delete text entries with titles, tags, and categories.
* a categories section, and a new history tab that logs all edits.
/** @jsxImportSource https://esm.sh/react */
import React, { useState, useEffect } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
interface TextEntry {
setHistory(data);
const handleSubmit = async (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault();
form.reset();
const handleTemplateSubmit = async (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault();
</div>
function client() {
createRoot(document.getElementById("root")!).render(<App />);
if (typeof document !== "undefined") {
client();
async function server(request: Request): Promise<Response> {
cynfria avatar
LandingPage
@cynfria
@jsxImportSource https://esm.sh/react@18.2.0
Script
/** @jsxImportSource https://esm.sh/react@18.2.0 */
import React from "https://esm.sh/react@18.2.0";
import { LoginWithGoogleButton } from "https://esm.town/v/stevekrouse/LoginWithGoogleButton";
export const LandingPage: React.FC = () => {
return (
text: string;
const FeatureItem: React.FC<FeatureItemProps> = ({ emoji, text }) => (
<div className="text-center">
kajgod avatar
manage_users_inputs
@kajgod
@jsxImportSource https://esm.sh/preact
Script
/** @jsxImportSource https://esm.sh/preact */
import { render } from "npm:preact-render-to-string";
const inputType = (type, name) => {
const displayName = name.replace("_", " ");
pomdtr avatar
fets_client
@pomdtr
An interactive, runnable TypeScript val by pomdtr
Script
import { client } from "https://esm.town/v/pomdtr/fets";
const resp = await client["/greetings"].get();
const res = await resp.json();
console.log(res.message);
jxnblk avatar
svg_card
@jxnblk
@jsxImportSource https://esm.sh/preact
Script
/** @jsxImportSource https://esm.sh/preact */
import { render } from "npm:preact-render-to-string";
const HEXRE = /^[A-Fa-f0-9]{3,6}$/;
const toHex = (str) => HEXRE.test(str) ? "#" + str : str;