Search

Results include substring matches and semantically similar vals. Learn more
janpaul123 avatar
valle_tmp_719883516769855647473989346238055
@janpaul123
// This is a simple Express HTTP val that returns "Hello, World!" when accessed.
HTTP
// This is a simple Express HTTP val that returns "Hello, World!" when accessed.
// It uses the Express framework to handle HTTP requests.
import express from "npm:express";
const app = express();
app.get("/", (req, res) => {
res.send("Hello, World!");
export default app.fetch;
dhvanil avatar
val_5jRwwTodiK
@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++) {
browserbase avatar
browserbaseUtils
@browserbase
Utils to loadPageContent() and screenshotPage() . Browserbase Browserbase offers a reliable, high performance serverless developer platform to run, manage, and monitor headless browsers at scale. Leverage our infrastructure to power your web automation and AI agents. Get started with Browserbase for free here . If you have any questions, reach out to developer@browserbase.com.
Script
Utils to `loadPageContent()` and `screenshotPage()`.
### Browserbase
Browserbase offers a reliable, high performance serverless developer platform to run, manage, and monitor headless browsers a
Get started with Browserbase for free [here](https://www.browserbase.com).
If you have any questions, reach out to developer@browserbase.com.
export interface LoadPageContentOptions {
textContent: boolean;
export async function loadPageContent(url: string, options: LoadPageContentOptions = { textContent: false }) {
const browser = await puppeteer.connect({
browserWSEndpoint: `wss://connect.browserbase.com?apiKey=${Deno.env.get("BROWSERBASE_API_KEY")}`,
andreterron avatar
debugSessionId
@andreterron
An interactive, runnable TypeScript val by andreterron
Script
export const debugSessionId = async (req, res) => {
res.set("Set-Cookie", "sessionid=helloworld; Path=/; HttpOnly");
res.send({ hello: "world" });
shaya avatar
getSofZmanShma
@shaya
An interactive, runnable TypeScript val by shaya
Script
import { fetch } from "https://esm.town/v/std/fetch";
export async function getSofZmanShma(city) {
console.log({ city });
const today = new Date().toISOString().split("T")[0];
const data = await (
await fetch(
`https://www.hebcal.com/zmanim?cfg=json&city=${city}&date=${today}`
).json();
console.log(data.times.sofZemanShma);
return data.times.sofZemanShma;
dhvanil avatar
val_8omNGabJ8G
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export default async function handler(req) {
try {
const result = await (async () => {
function findLowestThreeDigitFibonacci() {
let fib = [0, 1];
let nextFib = 1;
while (nextFib < 1000) {
nextFib = fib[fib.length - 1] + fib[fib.length - 2];
fib.push(nextFib);
return fib.filter(num => num >= 100 && num < 1000);
qqyule avatar
tomatoCaterpillar
@qqyule
An interactive, runnable TypeScript val by qqyule
HTTP
export default async function (req: Request): Promise<Response> {
return Response.json({ ok: true })
tmcw avatar
bandcampWrapped
@tmcw
Bandcamp Wrapped It's Spotify Wrapped, but for Bandcamp! . Bandcamp is for people who buy their music and probably most of them hoard MP3s. Like me. And this val helps those people turn their Bandcamp purchases of 2024 into HTML or Markdown suitable for blog posts on their blogs, which is probably a segment that has some overlap with the people who are wacky enough to buy their music instead of streaming it from some service. Because Bandcamp doesn't have an API, this hinges on you going to your purchases page, copying the purchases, and pasting it in. Thanks to the ability of the system clipboard to contain HTML , the same technology that makes copy-and-pasted text have unpredictable and annoying font and boldness choices also lets this parse and reformat that purchases page into something shareable. I would love for this to support embeds as well, but I haven't found a strategy yet: Bandcamp embeds use album IDs in the URLs, which are not exposed in the content on the purchases page. I'd have to scrape Bandcamp for that, which would probably inevitably be blocked by some 'bot protection' system. Also read about this on macwright.com .
HTTP
# Bandcamp Wrapped
It's Spotify Wrapped, but for [Bandcamp!](https://bandcamp.com/). Bandcamp is for people who buy their music and probably mos
turn their Bandcamp purchases of 2024 into HTML or Markdown suitable for blog posts on their blogs, which is probably a segme
wacky enough to buy their music instead of streaming it from some service.
Because Bandcamp doesn't have an API, this hinges on you going to your purchases page, copying the purchases, and pasting it
the ability of [the system clipboard to contain HTML](https://developer.mozilla.org/en-US/docs/Web/API/ClipboardItem), the sa
export default async function(req: Request): Promise<Response> {
return new Response(
<link rel="stylesheet" href="https://unpkg.com/missing.css@1.1.3">
<main>
jplhomer avatar
honoExample
@jplhomer
// Forked from @tmcw.honoExample
Script
export const honoExample = async (req: Request) => {
const { Hono } = await import("npm:hono");
const app = new Hono();
app.get("/", (c) => c.text("Hono yes?"));
app.get("/yeah", (c) => c.text("Routing ok!"));
return app.fetch(req);
// Forked from @tmcw.honoExample
jrmann100 avatar
valStorage
@jrmann100
An interactive, runnable TypeScript val by jrmann100
Script
export default <T,>() => {
const storageKey = whoami()[0];
return {
storageKey: storageKey,
get() {
return blob.getJSON(this.storageKey) as Promise<T | undefined>;
set(value: T | undefined) {
if (value === undefined) {
return blob.delete(this.storageKey);
return blob.setJSON(this.storageKey, value);
sdan avatar
getWeather
@sdan
An interactive, runnable TypeScript val by sdan
Script
export async function getWeather(city: string) {
try {
const response = await fetch(`https://wttr.in/${city}?format=j1`);
if (!response.ok) {
throw new Error(`Failed to fetch data for ${city}`);
const jsonData = await response.json();
const feelsLikeF = jsonData.current_condition[0].FeelsLikeF;
const weatherDescription =
jsonData.current_condition[0].weatherDesc[0].value;
return `${city}: feels like ${feelsLikeF}, ${weatherDescription}`;
stevekrouse avatar
test500
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Script
export let test500 = (req, res) => res.send(500);
jdan avatar
lichessDashboard
@jdan
A web interface for viewing a bunch of Lichess TV games. https://jdan-lichessDashboard.web.val.run
HTTP
A web interface for viewing a bunch of [Lichess TV](https://lichess.org/tv) games.
https://jdan-lichessDashboard.web.val.run
export const lichessDashboard = async () => {
const games = await lichessTVGames();
const validGameTypes = [
"Bot",
"UltraBullet",
"Bullet",
"Computer",
"Rapid",
stevekrouse avatar
express_ex
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Script
export const express_ex = (req: express.Request, res) => {
res.send(`${req.path}, ${req.originalUrl}`);
iwaltgen avatar
ifconfig
@iwaltgen
An interactive, runnable TypeScript val by iwaltgen
Script
export let ifconfig = (req, res) => {
const publicIp =
req.headers["x-forwarded-for"] || req.connection.remoteAddress;
return res.json({ publicIp });