Search
FontPack
@rektdeckard
An interactive, runnable TypeScript val by rektdeckard
HTTP
const CDN_BASE_URL = "https://unpkg.com/@phosphor-icons";
type SemVer = `${number}.${number}.${number}`;
type IconStyleMap = Partial<Record<IconStyle, string[]>>;
type FontFormatMap = Partial<Record<FontEditor.FontType, ArrayBuffer>>;
type SerialFontFormatMap = Partial<Record<FontEditor.FontType, string>>;
type FontPack = {
fonts: FontFormatMap;
css: string;
type SerialFontPack = {
fonts: SerialFontFormatMap;
token
@defel
An interactive, runnable TypeScript val by defel
Script
export let token = (req, res) => {
res.text("any-token-foo");
sqlite_explorer
@gaston
An interactive, runnable TypeScript val by gaston
HTTP
export default passwordAuth(async (request: Request) => {
const explorerResponse = await sqliteExplorerApp(request);
// If the explorer handled the request, return its response
if (explorerResponse.status !== 404) {
return explorerResponse;
// If the explorer didn't handle the request, return our custom HTML
return new Response(`
<!DOCTYPE html>
<html lang="en">
<head>
moduleHighlightValueLink
@postpostscript
moduleHighlightValueLink: Link to a Val With a Value or Method's Code Highlighted Examples: import { moduleHighlightValueLink, getRedirectUrl } from "https://esm.town/v/postpostscript/moduleHighlightValueLink";
console.log(await moduleHighlightValueLink("@std/email", "email"))
// https://val.town/v/std/email#L6-42
console.log(await moduleHighlightValueLink("@postpostscript/moduleHighlightValueLink", "moduleHighlightValueLink"))
// https://val.town/v/postpostscript/moduleHighlightValueLink#L6-20
// get URL you can imbed in an iframe
console.log(getRedirectUrl("@postpostscript/moduleHighlightValueLink", "getRedirectUrl", true));
// https://postpostscript-modulehighlightvaluelink.web.val.run/?embed=1&module=%40postpostscript%2FmoduleHighlightValueLink&name=getRedirectUrl Iframe example: import { htmlResponse } from "https://esm.town/v/postpostscript/html";
import { getRedirectUrl } from "https://esm.town/v/postpostscript/moduleHighlightValueLink";
export default async function(req: Request): Promise<Response> {
return htmlResponse`
<iframe src="${getRedirectUrl(import.meta.url, "default", true)}" width="100%" height="100%">
</iframe>
`;
}
HTTP
# moduleHighlightValueLink: Link to a Val With a Value or Method's Code Highlighted
## Examples:
```ts
console.log(await moduleHighlightValueLink("@std/email", "email"))
// https://val.town/v/std/email#L6-42
console.log(await moduleHighlightValueLink("@postpostscript/moduleHighlightValueLink", "moduleHighlightValueLink"))
getValEndpointFromUrl,
getValNameFromUrl,
getValUrlFromName,
moduleSource,
twitterRAG
@levi
NOTE: We've disabled the Exa API key in this demo due to high volume – you'll need to fork and provide your own to use it. Search on Twitter (powered by Exa ) and return a streaming markdown summary (powered by Substrate ). To fork, sign up for Substrate to get your own API key and $51 free credits. You'll also need Exa, which comes with generous free credits and can be a much cheaper alternative to the Twitter API.
HTTP
NOTE: We've disabled the Exa API key in this demo due to high volume – you'll need to fork and provide your own to use it.
Search on Twitter (powered by [Exa](https://exa.ai)) and return a streaming markdown summary (powered by [Substrate](https://substrate.run)).
To fork, [sign up for Substrate](https://substrate.run/) to get your own API key and $51 free credits.
You'll also need Exa, which comes with generous free credits and can be a much cheaper alternative to the Twitter API.
// NOTE: We've disabled the Exa API key in this demo due to high volume – you'll need to fork and provide your own to run it.
const exa = new Exa(Deno.env.get("EXA_API_KEY"));
const substrate = new Substrate({ apiKey: Deno.env.get("SUBSTRATE_API_KEY") });
const query = `"exa.ai" OR "@ExaAILabs"`;
// Search for tweets from the last week
const searchResults = await exa.searchAndContents(query, {
honoTanaEndpoint
@impedivity
An interactive, runnable TypeScript val by impedivity
HTTP
const token = Deno.env.get("tanaInputAPI");
export const honoTanaEndpoint = async (req: Request) => {
const app = new Hono();
app.get("/", async (c) => {
let { text, url } = c.req.query();
console.log(c.req);
const payload: APIPlainNode = {
name: text,
children: [
// type: "field",
splendidSapphireMockingbird
@maxm
An interactive, runnable TypeScript val by maxm
HTTP
export default async function (req: Request): Promise<Response> {
console.log(req)
return Response.json({ ok: true })
fetchDateMeProfiles
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Script
export const fetchDateMeProfiles = () =>
fetchTable(
dateMeURL,
) as Promise<{
"Name": string;
"Profile": {
"text": string;
"href": string;
"Gender": ("F" | "M" | "NF") | ("F" | "M" | "NF")[];
"Interested In"?: ("F" | "M" | "NF") | ("F" | "M" | "NF")[];
chatSampleFewShot
@webup
An interactive, runnable TypeScript val by webup
Script
import { chat } from "https://esm.town/v/webup/chat";
export const chatSampleFewShot = (async () => {
const prompt = `
return await chat(prompt);
textExtractorAndEmail
@sebch
An interactive, runnable TypeScript val by sebch
HTTP
async function extractWebsiteText(url: string): Promise<string> {
const response = await fetch(url, {
headers: {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'
const html = await response.text();
// Use node-html-parser for text extraction
const root = parse(html);
const textContent = root.textContent
.split('\n')
.map(line => line.trim())
helloWorldPDF
@neverstew
// View me at https://neverstew-helloWorldPDF.web.val.run
HTTP
// View me at https://neverstew-helloWorldPDF.web.val.run
export const helloWorldPDF = async (req: Request) => {
const { jsPDF } = await import("npm:jspdf");
const doc = new jsPDF();
doc.text("Hello world!", 10, 10);
return new Response(doc.output(), {
headers: { "Content-Type": "application/pdf" },
stevekrouseFollowing
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Script
import { twitterJSON } from "https://esm.town/v/stevekrouse/twitterJSON";
export const stevekrouseFollowing = (async () => {
let userId = 431200836; // stevekrouse
twitterJSON;
let resp = await fetchJSON(
`https://api.twitter.com/1.1/friends/ids.json?user_id=${userId}`,
headers: {
authorization: `Bearer ${process.env.twitter2}`,
console.log(resp);
return resp.ids.map((id) => id.toString());
CIDGeneration
@stevedylandev
An interactive, runnable TypeScript val by stevedylandev
Script
const JWT = Deno.env.get("PINATA_JWT");
export const calculateCid = async (bytes: Uint8Array) => {
const unixFs = unixfs({
blockstore: new BlackHoleBlockstore(),
const cid = await unixFs.addBytes(bytes, {
cidVersion: 0,
rawLeaves: false,
leafType: "file",
layout: balanced({
maxChildrenPerNode: 174,
handleSavePageForm
@rwev
An interactive, runnable TypeScript val by rwev
HTTP
import { email } from "https://esm.town/v/std/email?v=11";
export async function handleSavePageForm(req: Request) {
const formData = await req.formData();
const text = formData.get("text");
const latestVersionId = await savePageEntryDb(text);
return Response.redirect("https://rwev-page.web.val.run/");
// return new Response(`Text updated to version ${latestVersionId}`, {
// headers: {
// "Content-Type": "text/plain",
val_wjytJA6GCS
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export default async function handler(req) {
try {
const result = await (async () => {
function isPrime(num) {
if (num <= 1) return false;
for (let i = 2; i <= Math.sqrt(num); i++) {
if (num % i === 0) return false;
return true;
function findLowestThreeDigitPrime() {
for (let num = 100; num < 1000; num++) {