Search

Results include substring matches and semantically similar vals. Learn more
riodpp avatar
myApi
@riodpp
An interactive, runnable TypeScript val by riodpp
Script
export function myApi(name) {
return "hi " + name;
ejfox avatar
dbpediaenhanced
@ejfox
An API and basic interface for entity searching from DBPedia, enhanced with images
HTTP
import React, { useEffect, useState } from "https://esm.sh/react@18.2.0";
function sanitizeHtml(html) {
return html ? html.replace(/<\/?[^>]+(>|$)/g, "") : "";
function calculateScore(result, query) {
let score = 0;
return { score, explanation };
function App() {
const [query, setQuery] = useState("");
`curl 'https://ejfox-dbpediaenhanced.web.val.run/api/search?query=${encodeURIComponent(query || "example")}'`
function client() {
createRoot(document.getElementById("root")).render(React.createElement(App));
if (typeof document !== "undefined") { client(); }
async function fetchDBpediaResults(query: string) {
const lookupResponse = await fetch(
return scoredResults;
async function server(request: Request): Promise<Response> {
const url = new URL(request.url);
cescyang avatar
myApi
@cescyang
An interactive, runnable TypeScript val by cescyang
Script
export function myApi(name) {
return "hi " + name;
zzz avatar
OpenAISummary
@zzz
// Create a summary from a given text using GPT 4
Script
// Create a summary from a given text using GPT 4
export const OpenAISummary = async (text: string, config: {
apiKey?: string;
"anon",
"@zzz.OpenAISummary",
2,
const agent = await AIAgent(
apiKey || process.env.OPENAI_API_KEY_GPT4,
const response = await agent.summarize(text, modelName);
jasonw avatar
myApi
@jasonw
An interactive, runnable TypeScript val by jasonw
Script
export function myApi(name) {
return "hi " + name;
rayyan avatar
syllabus
@rayyan
@jsxImportSource npm:hono@3/jsx
HTTP
/** @jsxImportSource npm:hono@3/jsx */
import { Hono } from "npm:hono";
function omit<T>(key: keyof T, obj: T) {
const { [key]: omitted, ...rest } = obj;
return rest;
function omitKeys<T>(keys: Array<keyof T>, obj: T) {
const newObj: Record<keyof T, T[keyof T]> = {};
for (const key in obj) {
rapfl avatar
zottify
@rapfl
@jsxImportSource https://esm.sh/preact
HTTP
const replicate = new Replicate({
auth: Deno.env.get("REPLICATE_API_TOKEN"),
export default async function(req: Request) {
if (req.method === "POST") {
const formData = await req.formData();
dhvanil avatar
val_aOBDB44PKB
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_aOBDB44PKB(req) {
try {
// Execute the code directly and capture its result
tal avatar
fetchAndStore
@tal
An interactive, runnable TypeScript val by tal
Script
import { parseMenuLine } from "https://esm.town/v/tal/parseMenuLine";
import { fetchDOEMenu } from "https://esm.town/v/tal/fetchDOEMenu";
export async function fetchAndStore(opts: {
schoolYear: `${number}-${number}`;
month: string;
pomdtr avatar
fairAquaHeron
@pomdtr
An interactive, runnable TypeScript val by pomdtr
HTTP
export default async function() {
const body = await Deno.readFile("/opt/render/project/src/guest/index.ts");
return new Response(body);
ejfox avatar
allvals
@ejfox
An interactive, runnable TypeScript val by ejfox
HTTP
import ValTown from "https://esm.sh/@valtown/sdk";
async function server(request: Request): Promise<Response> {
const debugMessages: string[] = [];
try {
stordahl avatar
myApi
@stordahl
An interactive, runnable TypeScript val by stordahl
Script
export function myApi(name) {
return "hi " + name;
dhvanil avatar
val_vgmrhMlQrz
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_vgmrhMlQrz(req) {
try {
// Execute the code directly and capture its result
maxm avatar
infiniteSVGGraph
@maxm
Infinite SVG Graph A connected graph of AI-generated SVG images. Ask it to make any kind of SVG. Add your contribution to the graph. Make it POP!
HTTP
import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo?v=29";
import { OpenAI } from "https://esm.town/v/std/openai?v=4";
import { ResultSet, sqlite } from "https://esm.town/v/std/sqlite?v=6";
// Database querying.
function parseResultSet<T>(row: ResultSet): T[] {
return row.rows.map((r) => Object.fromEntries(r.map((c, i) => [row.columns[i], c]))) as T[];
await sqlite.execute(`SELECT * FROM ${tableName} ORDER BY heart_count DESC, RANDOM() LIMIT 100`),
// Client side javascript and template functions.
const clientJavascript = async () => {
createHeartBurst(event);
function createHeartBurst(event) {
const button = event.currentTarget;
}, 800);
function escapeHTML(html: string): string {
const escapeChars: { [char: string]: string } = {
app.post("/remix/:id", async (c) => {
const openai = new OpenAI();
const { prompt } = await c.req.json();
if (svg === undefined) return c.text("Not found", 404);
const stream = await openai.chat.completions.create({
messages: [
let encoder = new TextEncoder();
function isValidSVG(svgString) {
const parser = new DOMParser({
app.get("/:id/img.svg", async (c) => {
function addSVGNamespace(svgString) {
if (!/^<\?xml/.test(svgString)) svgString = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + svgString;
stevekrouse avatar
runAllTests2
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Script
import { TEST_API } from "https://esm.town/v/stevekrouse/TEST_API";
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
export async function runAllTests2({ names }: { names: string[] }) {
return names.map((name) =>
fetchJSON(`${TEST_API}/eval/@stevekrouse.${name}()`)