Search

Results include substring matches and semantically similar vals. Learn more
curtcox avatar
Chatio
@curtcox
An interactive, runnable TypeScript val by curtcox
HTTP (deprecated)
import { chatio } from "https://esm.town/v/curtcox/_chatio";
export const Chatio = (req: Request) => {
return chatio(req);
pncumhsk avatar
get
@pncumhsk
An interactive, runnable TypeScript val by pncumhsk
Script
export let get = () => {
var res = fetch("https://tampere.sometec.fi/showSpace03S.php", {
credentials: "include",
headers: {
"User-Agent":
"Mozilla/5.0 (X11; Linux x86_64; rv:108.0) Gecko/20100101 Firefox/108.0",
Accept: "application/json, text/javascript, */*; q=0.01",
"Accept-Language": "en-US,en;q=0.5",
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
"X-Requested-With": "XMLHttpRequest",
pomdtr avatar
api
@pomdtr
An interactive, runnable TypeScript val by pomdtr
Script
export async function api<T = any>(
path: string,
options?: RequestInit & {
authenticated?: boolean;
paginate?: boolean;
): Promise<T> {
const authorization = options?.authenticated ? `Bearer ${Deno.env.get("valtown")}` : undefined;
if (options?.paginate) {
const data = [];
let url = new URL(`${API_URL}${path}`);
jonbo avatar
reactSSRExample
@jonbo
An interactive, runnable TypeScript val by jonbo
Express
export const reactSSRExample = async (req: express.Request, res: express.Response) => {
// Import React
const React = await import("npm:react");
const ReactDOMServer = await import("npm:react-dom/server");
function BusTime(props) {
return React.createElement("span", null, "southbound in 5 minutes");
function BikeLocation(props) {
return React.createElement(
"li",
null,
tempdev avatar
flix
@tempdev
@jsxImportSource npm:hono/jsx
HTTP
/** @jsxImportSource npm:hono/jsx */
CMDBResponse,
episodeHandler,
play,
search,
seasonHandler,
ServerResponse,
StreamResponse,
watch,
} from "https://esm.town/v/tempdev/backend";
westbrookdaniel avatar
tomatoMarsupial
@westbrookdaniel
@jsxImportSource npm:react
HTTP (deprecated)
/** @jsxImportSource npm:react **/
export default (req: Request) => {
return new Response(
renderToString(
<html>
<link rel="stylesheet" href="https://unpkg.com/missing.css@1.1.1" />
<main>
<h1>Hello westbrookdaniel!</h1>
<p>This is your first val. It's pretty quick?</p>
</main>
niek avatar
spotify
@niek
// Uncomment this line for one run of the Val to create the DB lol
HTTP (deprecated)
// Uncomment this line for one run of the Val to create the DB lol
// await sqlite.execute(`create table if not exists SPOTIFY_AUTH_2(id text primary key, data text)`);
export const db = drizzle(sqlite as any);
export const table = sqliteTable("SPOTIFY_AUTH_2", {
id: text("id").primaryKey(),
data: text("data"),
const thisURL = thisWebURL();
const redirect_uri = thisURL + "/callback";
export let spotifyRequestToken = ({ client_id, client_secret, code, redirect_uri }) =>
fetchJSON("https://accounts.spotify.com/api/token", {
stevekrouse avatar
Debugging_Guide
@stevekrouse
@jsxImportSource https://esm.sh/hono@latest/jsx
HTTP
/** @jsxImportSource https://esm.sh/hono@latest/jsx **/
console.log("[Init] Starting Debugging_Guide val", new Date().toISOString());
export const Debugging_Guide = (c: any) => {
const html = `<!DOCTYPE html>
<html lang="en">
<head>
<title>Debugging Guide</title>
<style>
body {
font-family: system-ui, sans-serif;
vtdocs avatar
markdownExample
@vtdocs
An interactive, runnable TypeScript val by vtdocs
Express
export const markdownExample = async (req: express.Request, res: express.Response) => {
const marked = await import("npm:marked");
res.send(marked.parse(`
Using Marked, a Markdown Parser
[Marked](https://marked.js.org) is a widely used markdown parser.
Here, we've imported it using \`const marked = await import("npm:marked");\`!
pomdtr avatar
gfm
@pomdtr
Markdown to html (with github styling)
Script
# Markdown to html (with github styling)
export function html(markdown: string) {
return micromark(markdown, {
extensions: [gfmMarkdown(), frontmatter()],
htmlExtensions: [gfmHtml(), frontmatterHtml()],
export async function gfm(markdown: string, options?: { title?: string; favicon?: string | URL }) {
const body = await html(markdown);
const faviconURL = new URL(options?.favicon ?? "📝", "https://fav.farm");
return `
<!DOCTYPE html>
yawnxyz avatar
honoAlpineExample
@yawnxyz
// Endpoint to catch and log the submitted name
HTTP (deprecated)
const app = new Hono();
// Endpoint to catch and log the submitted name
app.post("/submit-name", async (c) => {
const data = await c.req.parseBody();
console.log('data:', data, Object.keys(data));
console.log("Received name:", data.name);
return c.json({ message: `Received name: ${data.name}` });
// Serve the HTML page with Alpine.js
app.get("/", (c) => {
const html = `
dthyresson avatar
playMeASong
@dthyresson
Play me a song Search and if we find it, it'll open the song in Spotify! Feeling Lucky? Play a random song . Like a band? Play one of their tracks.
HTTP (deprecated)
# Play me a song
Search and if we find it, it'll open the song in Spotify!
Feeling Lucky? Play a [random song](https://dthyresson-playrandomsong.web.val.run).
Like a band? Play [one](https://dthyresson-playrandomsong.web.val.run?artist=New+Order) of their tracks.
/** @jsxImportSource npm:hono@3/jsx */
type Track = {
id: number | null;
artist: string;
title: string;
track_id: string | null;
easrng avatar
vtTypes
@easrng
An interactive, runnable TypeScript val by easrng
HTTP (deprecated)
export default async function(req: Request): Promise<Response> {
const urls = [
"https://deno.land/x/deno@v1.40.2/cli/tsc/dts/lib.d.ts",
"https://deno.land/x/deno@v1.40.2/cli/tsc/dts/lib.dom.d.ts",
"https://deno.land/x/deno@v1.40.2/cli/tsc/dts/lib.dom.iterable.d.ts",
"https://deno.land/x/deno@v1.40.2/cli/tsc/dts/lib.dom.asynciterable.d.ts",
"https://deno.land/x/deno@v1.40.2/cli/tsc/dts/lib.webworker.d.ts",
"https://deno.land/x/deno@v1.40.2/cli/tsc/dts/lib.webworker.importscripts.d.ts",
"https://deno.land/x/deno@v1.40.2/cli/tsc/dts/lib.webworker.iterable.d.ts",
"https://deno.land/x/deno@v1.40.2/cli/tsc/dts/lib.scripthost.d.ts",
wilt avatar
emojify
@wilt
An interactive, runnable TypeScript val by wilt
Script
export async function emojify(input: string): Promise<string> {
const { emojify } = await import("npm:emojify-lyrics");
return emojify(input);
thecurryman avatar
sapphireManatee
@thecurryman
@jsxImportSource https://esm.sh/preact
HTTP (deprecated)
/** @jsxImportSource https://esm.sh/preact */
export let isBoeing = async (airline, number) => {
const response = await fetch("https://www.flightstats.com/v2/flight-tracker/" + airline + "/" + number);
const body = await response.text();
const $ = cheerio.load(body);
const boeingElements = $("h5").filter(function() {
return $(this).text().includes("Boeing");
let aircraft = [];
boeingElements.each(function() {
aircraft.push($(this).text());