Search

Results include substring matches and semantically similar vals. Learn more
hunty avatar
bumpyGreenAntelope
@hunty
Fetch Template Example template to quickly get started with a backend for Fetch in Framer.
HTTP
# Fetch Template
Example template to quickly get started with a backend for Fetch in Framer.
import { cors } from "npm:hono/cors";
const app = new Hono();
app.use(cors());
app.get("/", async (c) => {
return c.json({ data: "https://gravatar.com/avatar/cb18420ea6d5e7d80748de33a18b6149?size=256" });
export default app.fetch;
rym avatar
parseHTML
@rym
An interactive, runnable TypeScript val by rym
Script
export const parseHTML = async (
html: string,
process: (document) => Promise<any>
console.log("pre import");
const { DOMParser } = await import(
"https://deno.land/x/deno_dom@v0.1.38/deno-dom-wasm.ts"
console.log("pre-parse");
const document = new DOMParser().parseFromString(html, "text/html");
console.log("pre-process");
return await process(document);
ggarnhart avatar
citiBikeSpotChecker
@ggarnhart
An interactive, runnable TypeScript val by ggarnhart
Express (deprecated)
export const citiBikeSpotChecker = async (req, res) => {
const { data } = await fetch(
"https://gbfs.citibikenyc.com/gbfs/en/station_status.json"
).then((r) => r.json());
const { stations } = data;
const { ids } = req.body;
const selectedStations = stations.filter((item) =>
ids.includes(item.station_id)
const idToInfo = {};
selectedStations.forEach((item) => {
yawnxyz avatar
semanticSearch
@yawnxyz
In-memory semantic search; load it up with valtown KV. This is a "dumb" version of vector search, for prototyping RAG responses and UIs โ€” with both regular search (w/ Lunr) and vector search (with OpenAI embeddings + cosine similarity) Usage: import { semanticSearch } from "https://esm.town/v/yawnxyz/semanticSearch"; const documents = [ { id: 1, content: 'cats dogs' }, { id: 2, content: 'elephants giraffes lions tigers' }, { id: 3, content: 'edam camembert cheddar' } ]; async function runExample() { // Add documents to the semantic search instance await semanticSearch.addDocuments(documents); const results = await semanticSearch.search('animals', 0, 3); console.log('Top 3 search results for "animals":'); console.log(results); } runExample();
Script
In-memory semantic search; load it up with valtown KV.
This is a "dumb" version of vector search, for prototyping RAG responses and UIs โ€” with both regular search (w/ Lunr) and vec
Usage:
const documents = [
{ id: 1, content: 'cats dogs' },
{ id: 2, content: 'elephants giraffes lions tigers' },
const app = new Hono();
app.use('*', cors({
origin: '*',
allowMethods: ['GET', 'POST'],
stevekrouse avatar
gitReleaseNotes
@stevekrouse
Github Release Notes from package.json Enter a raw github URL to a package.json, https://raw.githubusercontent.com/username/repo/branch/package.json and get a response of all release notes for all packages from current to latest. Roadmap [ ] GenAI summary [ ] Weekly cron email reports [ ] Other package managers like PyPi [ ] Formatting/styling [ ] Loading spinner
HTTP
# Github Release Notes from `package.json`
Enter a raw github URL to a package.json,
https://raw.githubusercontent.com/username/repo/branch/package.json
and get a response of all release notes for all packages from current to latest.
## Roadmap
- [ ] GenAI summary
/** @jsxImportSource npm:hono@3/jsx */
interface PackageJson {
dependencies?: Record<string, string>;
devDependencies?: Record<string, string>;
nbbaier avatar
honoZodSwaggerUi
@nbbaier
// The OpenAPI documentation will be available at /doc
HTTP
const ParamsSchema = z.object({
id: z
.string()
.min(3)
.openapi({
param: {
name: "id",
in: "path",
example: "1212121",
const UserSchema = z
Gcoxy avatar
nobleOrangeGopher
@Gcoxy
An interactive, runnable TypeScript val by Gcoxy
Script
export const handler = async (req) => {
console.log("Label system test running...");
return new Response(
JSON.stringify({
message: "Label System is working!",
timestamp: new Date().toISOString(),
headers: {
"Content-Type": "application/json",
dhvanil avatar
val_rP0fdOu8JK
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_rP0fdOu8JK(req) {
try {
// Execute the code directly and capture its result
const result = await (async () => {
// Enhanced Game of Life with consciousness levels
class ConsciousnessGrid {
constructor(size = 10) {
this.size = size;
// Each cell now has an energy level (0-1) instead of just binary state
this.grid = Array(size).fill().map(() =>
summers avatar
isMyWebsiteDown
@summers
An interactive, runnable TypeScript val by summers
Script
export const isMyWebsiteDown = async (req, res) => {
if (req.get("auth") !== process.env.authtoken)
return res.end("Unauthorized");
const URL = process.env.site1;
const [date, time] = new Date().toISOString().split("T");
let ok = true;
let reason: string;
try {
const res = await fetch(URL);
if (res.status !== 200) {
iamseeley avatar
typingCli
@iamseeley
๐Ÿšง when you want a command line typing effect see styles: typingcliStyles [ ] improve styles (invert text color w/ background when at current character)
Script
## ๐Ÿšง when you want a command line typing effect
see styles: [typingcliStyles](https://www.val.town/v/iamseeley/typingcliStyles)
- [ ] improve styles (invert text color w/ background when at current character)
export function typingCli(element, text, callback = () => {}) {
let i = 0;
function type() {
if (i < text.length) {
const span = document.createElement('span');
span.textContent = text.charAt(i);
element.appendChild(span);
chris_symbiote avatar
runPostSaveMessage
@chris_symbiote
An interactive, runnable TypeScript val by chris_symbiote
Script
export const runPostSaveMessage = (async () => {
const response = await fetch(
"https://chris_symbiote-postSaveMessage.express.val.run",
method: "POST",
headers: {
"Accept": "application/json",
"Content-Type": "application/json",
body: JSON.stringify({ message: "Textual content" }),
console.log(JSON.stringify({ message: "Textual content" }));
console.log(response.status);
mepuka avatar
rideWithGPSredirect
@mepuka
An interactive, runnable TypeScript val by mepuka
Script
export let rideWithGPSredirect = (req, res) => {
console.log(req);
res.status(200).send({ results: JSON.stringify(req) });
stevekrouse avatar
blushAardwolf
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
HTTP
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
const blog_bookmark = await fetchJSON(
"https://datasette.simonwillison.net/simonwillisonblog/blog_blogmark.json?_labels=on&_shape=objects",
const blog_quotation = await fetchJSON(
"https://datasette.simonwillison.net/simonwillisonblog/blog_quotation.json?_labels=on&_shape=objects",
export default () => Response.json({ blog_bookmark, blog_quotation });
sairamoe avatar
testHTML
@sairamoe
// Forked from @tr3ntg.testHTML
Script
export function testHTML(req: express.Request, res: express.Response) {
res.send(
"<html lang='en'>" +
"<head>" +
"<meta charset='utf-8'>" +
"<title>Hello World</title>" +
"</head>" +
"<body>" +
"<h1><a href='https://example.com/'>Hello World</a></h1>" +
"</body>" +
dhvanil avatar
val_5PE61NGtHN
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_5PE61NGtHN(req) {
try {
// Execute the code directly and capture its result
const result = await (async () => {
// Enhanced Game of Life with consciousness paths and interaction types
class ConsciousnessNetwork {
constructor(size = 8) {
this.size = size;
this.grid = Array(size).fill().map(() =>
Array(size).fill().map(() => ({
โ€ฆ
197
โ€ฆ
Next