Search

Results include substring matches and semantically similar vals. Learn more
mstubbs avatar
flydotioRSS
@mstubbs
An interactive, runnable TypeScript val by mstubbs
HTTP
export async function flydotioRSS(req: Request): Promise<Response> {
const response = await fetch("https://fly.io/blog/");
const body = await response.text();
const $ = cheerio.load(body);
const feed = new Feed({
title: "Fly.io Blog",
description: "This is my personal feed!",
id: "https://fly.io/blog/",
link: "https://fly.io/blog/",
image: "https://fly.io/static/images/favicon/favicon-32x32.png",
pomdtr avatar
search_heroicons
@pomdtr
An interactive, runnable TypeScript val by pomdtr
Script
export default async function(ctx: BrowserContext) {
const resp = await fetch("https://api.iconify.design/collection?prefix=heroicons");
if (!resp.ok) {
throw new Error(await resp.text());
const { uncategorized: icons } = await resp.json() as { uncategorized: string[] };
const items = icons.filter(
(icon) => !icon.endsWith("-solid"),
).map(icon => ({
icon,
title: icon,
Choudhary avatar
harmoniousPurpleWolf
@Choudhary
An interactive, runnable TypeScript val by Choudhary
HTTP
export default async function (req: Request): Promise<Response> {
return Response.json({ ok: true })
stevekrouse avatar
expressTestSimple
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Script
export const expressTestSimple = (req, res) => res.send("success!");
justbe avatar
wasmExample
@justbe
An interactive, runnable TypeScript val by justbe
HTTP
const wabt = await loadWabt();
export default async function(req: Request): Promise<Response> {
return new Response(
wabt.parseWat(
`test.wasm`,
`(module
(func $add (param $lhs i32) (param $rhs i32) (result i32)
local.get $lhs
local.get $rhs
i32.add)
mickey_24 avatar
fantasticEmeraldSquid
@mickey_24
An interactive, runnable TypeScript val by mickey_24
HTTP
export default async function (req: Request): Promise<Response> {
return Response.json({ ok: true })
yawnxyz avatar
unpaywall
@yawnxyz
// Unpaywall DOI access function
HTTP
const app = new Hono();
const YOUR_EMAIL = "jan@phage.directory";
// Unpaywall DOI access function
async function unpaywallDOI(doi) {
const url = `https://api.unpaywall.org/v2/${doi}?email=${YOUR_EMAIL}`;
const options = {
method: 'GET',
headers: {
'accept': 'application/json',
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0
iamseeley avatar
pyodideSetup
@iamseeley
An interactive, runnable TypeScript val by iamseeley
Script
const pyodideUrl = "https://cdn.jsdelivr.net/pyodide/v0.26.4/full/";
export async function initializePyodide() {
// Set up the global objects that Pyodide expects
(globalThis as any).window = globalThis;
(globalThis as any).document = {
location: { href: pyodideUrl },
currentScript: { src: `${pyodideUrl}pyodide.js` }
(globalThis as any).navigator = {
userAgent: 'Mozilla/5.0 (Pyodide)'
// Import Pyodide
roadlabs avatar
webinstruction
@roadlabs
tldraw computer custom endpoint example This val is an example custom endpoint for tldraw computer 's data component. Usage To use this val with tldraw.computer, follow these steps: Fork this Val. Click the Copy endpoint button on your new Val. Open a project on tldraw.computer Create a Data component in your tldraw computer project In the Source dropdown, select Custom and the POST method Paste the endpoint into Data component's the HTTP Endpoint input. Run the component. To see the output, connect the Data component to a Text component. How it works In tldraw computer, you can configure a Data component to use a custom HTTP endpoint as its data source. You can also configure the request method, either GET or POST. If a Data component's request method is POST, then when the component next updates, it will send a POST request to the endpoint. The request's body will contain an array of the Data objects that the component had received as inputs. If the request method if GET, then the component will only make the request—its body will be empty. In both cases, the component will expect back a response that includes an array of Data objects these objects will be passed along as the data component's outputs. The endpoint (your forked version of this Val) can do whatever it likes between the request and response, but the response must include data in the correct format. If the format is wrong, the computer app will create a text data object instead that includes the response as plain text. Support If you're running into any difficulties, check out the #tldraw-computer channel on the tldraw discord.
HTTP
# tldraw computer custom endpoint example
This val is an example custom endpoint for [tldraw computer](tldraw.computer)'s data component.
### Usage
To use this val with tldraw.computer, follow these steps:
1. Fork this Val.
2. Click the **Copy endpoint** button on your new Val.
// This endpoint accepts and returns data.
type BooleanData = {
type: "boolean";
text: "true" | "false" | "maybe";
janpaul123 avatar
valle_tmp_9644417173466035944233895282862
@janpaul123
// This val responds with "Hello world" to all incoming requests
HTTP
// This val responds with "Hello world" to all incoming requests
export default async function (req: Request): Promise<Response> {
return new Response("Hello world");
jeffreyyoung avatar
freshBeigeScorpion
@jeffreyyoung
Shows a preview and then says meow for 5 seconds https://poe.com/preview-then-slow things to note: don't put underscores in the name name, it stops working
HTTP
Shows a preview and then says meow for 5 seconds
https://poe.com/preview-then-slow
things to note:
- don't put underscores in the name name, it stops working
* Returns a response to the user's query
async function getResponse(req: Query, send: SendEventFn) {
send("meta", { content_type: "text/markdown" });
send("text", {
text: `
Here is a preview
jeffreyyoung avatar
competitiveGraySkunk
@jeffreyyoung
Shows a preview and then says meow for 5 seconds https://poe.com/preview-then-slow things to note: don't put underscores in the name name, it stops working
HTTP
Shows a preview and then says meow for 5 seconds
https://poe.com/preview-then-slow
things to note:
- don't put underscores in the name name, it stops working
* Returns a response to the user's query
async function getResponse(req: Query, send: SendEventFn) {
send("meta", { content_type: "text/markdown" });
let i = 0;
let message = "";
let totalLength = 0;
rozek avatar
vtu_deleteUser
@rozek
(documentation follows)
Script
(documentation follows)
import {
expectEMailAddress
} from 'npm:javascript-interface-library'
import { blob } from "https://esm.town/v/std/blob"
export default async function deleteUser (UserId:string):Promise<void> {
expectEMailAddress('user id',UserId)
const normalizedUserId = UserId.toLowerCase().trim()
const UserKey = `vtu_User_${normalizedUserId}`
await blob.delete(UserKey)
yieldray avatar
crux_add
@yieldray
An interactive, runnable TypeScript val by yieldray
Script
export async function crux_add(name: string, content: string) {
const res = await fetch("https://crux.land/api/add", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
name: ["ts", "tsx", "mts", "cts", "js", "jsx", "mts", "mjs"].map((ext) =>
`.${ext}`
).some((ext) => name.endsWith(ext))
? name
: `${name}.js`,
curtcox avatar
authorized
@curtcox
An interactive, runnable TypeScript val by curtcox
Script
export interface Responder {
(req: Request): Promise<Response>;
export interface AuthTest {
(req: Request): boolean;
export const authorized = (req: Request, test: AuthTest, onPass: Responder, onFail: Responder) => {
return test(req) ? onPass(req) : onFail(req);