Search

Results include substring matches and semantically similar vals. Learn more
gtrufitt avatar
handleChatGPTRequest
@gtrufitt
An interactive, runnable TypeScript val by gtrufitt
Script
export async function handleChatGPTRequest(req: express.Request, res) {
console.log(req.body);
console.email("Ran");
parkddongddoong avatar
CS1200
@parkddongddoong
// 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",
zishan avatar
convivialEmeraldMoth
@zishan
An interactive, runnable TypeScript val by zishan
HTTP
export default async function (req: Request): Promise<Response> {
return Response.json({ ok: true })
janpaul123 avatar
valle_tmp_92751004685681985320195796915739
@janpaul123
// Response with "Hello World" on every HTTP request
HTTP
// Response with "Hello World" on every HTTP request
export default async function(req: Request): Promise<Response> {
return new Response("Hello World", { headers: { "Content-Type": "text/plain" } });
ejfox avatar
weeksummary
@ejfox
@jsxImportSource https://esm.sh/react
HTTP
tagCounts: Record<string, number>;
function App() {
const [summary, setSummary] = useState<string>("");
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
client();
async function server(request: Request): Promise<Response> {
const url = new URL(request.url);
if (url.pathname === "/api/summary") {
const { OpenAI } = await import("https://esm.town/v/std/openai");
const openai = new OpenAI();
const supabaseUrl = Deno.env.get("SUPABASE_PERSONAL_URL");
title: scrap.title ? scrap.title.substring(0, 256) : "",
// Generate summary using OpenAI
try {
).join("\n");
const completion = await openai.chat.completions.create({
messages: [
botuha20 avatar
BadmintonMatchMakerApp
@botuha20
@jsxImportSource https://esm.sh/react
HTTP
return allPairings;
function App() {
const [players, setPlayers] = useState<Player[]>([]);
</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(`
aritjt avatar
immaculateBlackLungfish
@aritjt
An interactive, runnable TypeScript val by aritjt
HTTP
export default async function(req: Request): Promise<Response> {
return Response.json({ ok: true });
janpaul123 avatar
valwriter_output
@janpaul123
// This approach fetches weather data for Brooklyn, NY from the Open Meteo API
Script
// It then parses the response to extract the current temperature
import axios from "npm:axios@0.21.1";
export default async function main() {
// Fetch weather data for Brooklyn, NY
const response = await axios.get(
janpaul123 avatar
valle_tmp_2561069655856986264488337570741
@janpaul123
// This val will respond with a funky HTML page with crazy fonts and gradients!
HTTP
// This val will respond with a funky HTML page with crazy fonts and gradients!
export default async function main(): Promise<Response> {
const htmlContent = `
<!DOCTYPE html>
jrunning avatar
regexWordSearchPage
@jrunning
Search a corpus of 479,000 English words by regular expression
HTTP
import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
function App() {
const [searchTerm, setSearchTerm] = useState("");
useEffect(() => {
async function fetchWords() {
try {
margin: 0,
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(`
mahendradani avatar
DailyMotivation
@mahendradani
Email myself a motivating quote everyday at 6:00 AM
Cron
import { email } from "https://esm.town/v/std/email";
export default async function(interval: Interval) {
await email({ subject: "Daily Motivation", text: "You can do it!" });
stevekrouse avatar
alive
@stevekrouse
Human Alive-ness API It works by querying Wikidata via SPARQL to search for birth and death dates of a person. Requires an exact name match. It will throw if it can't find results. It will return true if every match has a birth date and not a death date. (It will return false if a match does not have a birth date, because we assume that to mean they are a historical figure whose birthdate we don't know.) @stevekrouse.alive("Henry Kissinger") // true (for now) You can view some example usages / tests here: https://www.val.town/v/stevekrouse.aliveTests
Script
import { wikidata } from "https://esm.town/v/stevekrouse/wikidata";
export async function alive(name) {
let data = await wikidata(
`SELECT ?person ?personLabel ?birth_date ?death_date WHERE {
vandyand avatar
rateArticleRelevance
@vandyand
An interactive, runnable TypeScript val by vandyand
Script
export const rateArticleRelevance = async (interests: string, article: any) => {
const { default: OpenAI } = await import("npm:openai");
const openai = new OpenAI({
apiKey: untitled_tealCoral.OPENAI_API_KEY,
try {
Give a score from 0 to 10. Why did you give this score? Respond with the score only.
const response = await openai.chat.completions.create({
messages: [
janpaul123 avatar
valle_tmp_26658746570535136802306869503814
@janpaul123
An interactive, runnable TypeScript val by janpaul123
HTTP
export default async function main(req: Request): Promise<Response> {
// Helper functions for Blob storage
async function getBlob(key: string): Promise<any> {
const response = await fetch(`https://api.val.town/v/std/blob-${key}`);
return response.json();
async function setBlob(key: string, data: any): Promise<void> {
const response = await fetch(`https://api.val.town/v/std/blob-${key}`, {
charmaine avatar
JokeGenerator
@charmaine
Joke Generator Returns a random joke from https://official-joke-api.appspot.com/random_joke Example:
HTTP
export default async function(req: Request) {
// Return a random joke with API
const response = await fetch("https://official-joke-api.appspot.com/random_joke");