Search
valle_tmp_927670008317521815777284598519392
@janpaul123
// This val responds with "Hello world" to all incoming HTTP requests
HTTP
// This val responds with "Hello world" to all incoming HTTP requests
export default async function main(req: Request): Promise<Response> {
return new Response("Hello world");
![simonw avatar](https://secure.gravatar.com/avatar/de99266e9eaac8b6946541f8661afbd8.jpg?s=200&d=identicon)
jsPython
@simonw
An interactive, runnable TypeScript val by simonw
Script
const { jsPython } = await import("npm:jspython-interpreter");
const script = `
def mapFunction(r, i):
v = r * i
return v
x = [1, 2, 3, 4]
x
.map(mapFunction)
.filter(r => r * r)
.join(",")
scrapeWebsite
@oca99
An interactive, runnable TypeScript val by oca99
Script
import { fetch } from "https://esm.town/v/std/fetch";
export async function scrapeWebsite(url) {
const { DOMParser } = await import(
"https://deno.land/x/deno_dom@v0.1.38/deno-dom-wasm.ts"
myApi
@sibrel
An interactive, runnable TypeScript val by sibrel
Script
export function myApi(name) {
return "hi " + name;
pyodidePowersVis
@iamseeley
An interactive, runnable TypeScript val by iamseeley
HTTP
<div id="plot"></div>
<script>
async function main() {
let pyodide = await loadPyodide();
await pyodide.loadPackage('matplotlib');
valle_tmp_33622208006880749293871176826736
@janpaul123
// This val responds to HTTP requests with "Hello, World!".
HTTP
// This val responds to HTTP requests with "Hello, World!".
// It uses Deno's built-in HTTP server.
export default async function main(req: Request): Promise<Response> {
return new Response("Hello, World!", {
headers: { "Content-Type": "text/plain" },
echo
@twschiller
An interactive, runnable TypeScript val by twschiller
HTTP
export function echo(args) {
return args;
![pomdtr avatar](https://images.clerk.dev/oauth_github/img_2RCoAITJZH1QencEgtVjh4Qirj4.jpeg)
sqliteExplorerApp
@pomdtr
SQLite Explorer View and interact with your Val Town SQLite data. It's based off Steve's excellent SQLite Admin val, adding the ability to run SQLite queries directly in the interface. This new version has a revised UI and that's heavily inspired by LibSQL Studio by invisal . This is now more an SPA, with tables, queries and results showing up on the same page. Install Install the latest stable version (v37) by forking this val that imports & exports it in your account: Authentication SQLite Explorer basic authentication with your Val Town API Token as the password (leave the username field blank). Todos / Plans [ ] fix wonky sidebar separator height problem [ ] improve error handling [ ] improve table formatting [ ] make result tables scrollable [ ] add codemirror [ ] add loading indication to the run button (initial version shipped) [ ] add ability to favorite queries [ ] add saving of last query run for a table (started) [ ] add visible output for non-query statements [ ] add schema viewing [x] add export to CSV, and JSON (CSV and JSON helper functions written in this val ) [ ] add export to sqlite [ ] add refresh to table list sidebar after CREATE/DROP/ALTER statements [ ] add automatic execution of initial select query on double click [x] add listener for cmd+enter to submit query [ ] add views to the sidebar
HTTP
- [ ] add schema viewing
- [x] add export to CSV, and JSON (CSV and JSON helper functions written in [this val](https://www.val.town/v/nbbaier/sqliteExportHelpers))
- [ ] add export to sqlite
myApi
@paulwilkinson
An interactive, runnable TypeScript val by paulwilkinson
Script
export function myApi(name) {
return "hi " + name;
![steveb1313 avatar](https://images.clerk.dev/oauth_github/img_2ScQNOcM00tE7lUO4C1SNYWjjY4.png)
GetPelotonWorkoutsAndSaveToAirTable
@steveb1313
An interactive, runnable TypeScript val by steveb1313
Script
import { fetch } from "https://esm.town/v/std/fetch";
import process from "node:process";
export async function GetPelotonWorkoutsAndSaveToAirTable(
req: express.Request,
res: express.Response,
total_work: ["total_work"],
{ typecast: true },
function (err, record) {
if (err) {
console.error(err);
ogImage
@moe
@jsxImportSource https://esm.sh/react
Script
import { render } from "https://deno.land/x/resvg_wasm/mod.ts"
import satori from "npm:satori"
export async function ogImage(body) {
const svg = await satori(
body,
val_3t2CaHt9pC
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_3t2CaHt9pC(req) {
try {
// Execute the code directly and capture its result
![pomdtr avatar](https://images.clerk.dev/oauth_github/img_2RCoAITJZH1QencEgtVjh4Qirj4.jpeg)
fetchValTownAPI
@pomdtr
Fetch data from the val town api Usage Create an helper val const valtownApi = (path: string, options?: RequestInit) =>
@pomdtr.fetchValTownAPI(
@me.secrets.apiToken,
path,
options,
); Then use it in any of your val @me.valtownApi("/alias/pomdtr")
Script
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
export async function fetchValTownAPI(
apiToken: string,
path: string,
![vladimyr avatar](https://images.clerk.dev/oauth_github/img_2TYEBDWl6QE7Nsk4AHoXsDuwvBE.png)
postEval
@vladimyr
// import { fetchTweet } from "https://esm.town/v/dpetrouk/fetchTweet?v=35";
HTTP
import { fetchTweet } from "https://esm.town/v/vladimyr/fetchTweet";
export default async function(req: Request): Promise<Response> {
const reqURL = new URL(req.url);
return Response.json({ code, post, result }, { status: 500 });
export async function postEval(post, args?) {
const code = post.text.split("```")[1]
return eval_(code, args);
export async function fetchPost(url: string | URL) {
const postURL = new URL(url);