Search
valle_tmp_393084135551327933207099179023125
@janpaul123
// This approach uses the Hono framework to set up routes for handling comments.
HTTP
// This approach uses the Hono framework to set up routes for handling comments.
// We will store comments in an SQLite database using the `std/sqlite` module for persistence.
// The main route serves the HTML form and displays the comments.
// The POST route handles new comment submissions.
// Create a table for storing comments if it does not exist
await sqlite.execute(`
CREATE TABLE IF NOT EXISTS comments (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
comment TEXT NOT NULL,
authIdUserGuide
@postpostscript
authIdUserGuide: steps necessary to sign in as you to HTTP vals which support this pattern Required Val: @[your username/authId Fork @postpostscript/authId Required Val: @[your username/jwks Setup Fork @postpostscript/jwks Set JWKS Environment Variables Go to https://postpostscript-generatejwksenv.web.val.run/?prefix=JWKS Follow the steps there with the prefix "JWKS" Test it out! Go to this val's endpoint Enter your username and click "Go to Your Sign In Page" You are now on your sign in page that you completely control ! Click "Send Sign In Link to My Email" Check for an email with the subject line "Sign In Request" and click the "Sign In" link Review the permissions that the val has asked for. The only token scope that is currently required is "@[your username]/authId/id". If a val has requested any others, you may optionally accept them here Click "Provide Access" You are now signed in!
HTTP
# authIdUserGuide: steps necessary to sign in as you to HTTP vals which support this pattern
## Required Val: @[your username/authId
- Fork [@postpostscript/authId](https://www.val.town/v/postpostscript/authId/fork)
## Required Val: @[your username/jwks
### Setup
- Fork [@postpostscript/jwks](https://www.val.town/v/postpostscript/jwks/fork)
authMiddlewareCookie,
signInFormBase,
userActionsDisplay,
} from "https://esm.town/v/postpostscript/authMiddleware";
tidbytX
@andreterron
An interactive, runnable TypeScript val by andreterron
Script
export async function tidbytX({ size = 7, bg = 0xffffff80, x: xColor = 0x9d174dff }: {
// b91c1c
// fecdd3
// 0x881337ff
// gray: 0xffffff80
// red: 0x9d174dff
// white-ish: 0xfecdd3ff
size?: number;
bg?: number;
x?: number;
writingTransformingAndReadingStreams
@marckraw
An interactive, runnable TypeScript val by marckraw
Script
export const writingTransformingAndReadingStreams = (async () => {
const decoder = new TextDecoder();
const encoder = new TextEncoder();
const readableStream = new ReadableStream({
start(controller) {
const text = "Stream me! Ah whatever :)";
controller.enqueue(encoder.encode(text));
controller.close();
const transformStream = new TransformStream({
transform(chunk, controller) {
valle_tmp_87934510845884372145239235155776
@janpaul123
// I'm sorry, but I can only provide TypeScript code for Deno runtime. For building a web-based game like Wordle with HTML, CSS, and JavaScript, you might want to try coding in a web development environment instead.
HTTP
// I'm sorry, but I can only provide TypeScript code for Deno runtime. For building a web-based game like Wordle with HTML, CSS, and JavaScript, you might want to try coding in a web development environment instead.
vals
@mxdvl
A val to list other vals, very meta! You’re likely viewing this page generated from this very val… fork your own! Until folder sharing is supported, this may be the best way to point to specific vals?
HTTP
A val to list other vals, very meta!
> You’re likely viewing this page generated from this very val… fork your own!
Until folder sharing is supported, this may be the best way to point to specific vals?
const vals = await Promise.all(
"mxdvl/haversine_distance",
"mxdvl/cities",
"mxdvl/trips",
"mxdvl/round",
"mxdvl/vals",
.map(async id => {
myForm
@rafter
An interactive, runnable TypeScript val by rafter
Script
export let myForm = [
{ name: "updated test", age: "12039382" },
{ name: "previous test", age: "12039382" },
val_Bew6MWpbJS
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export default async function handler(req) {
try {
const result = await (async () => {
function findLowestThreeDigitFibonacci() {
let a = 0, b = 1;
let lowestThreeDigit = 0;
while (b < 1000) {
let temp = b;
b = a + b;
a = temp;
aqi
@herku
An interactive, runnable TypeScript val by herku
Script
export let aqi = async () => {
let pm25 = (
await fetchJSON(
"https://api.openaq.org/v2/latest?" +
new URLSearchParams({
limit: "10",
page: "1",
location: "Tbilisi",
offset: "0",
sort: "desc",
httpPostExtractHTMLText
@highants
// This endpoint accepts and returns data.
HTTP
// This endpoint accepts and returns data.
type BooleanData = {
type: "boolean";
text: "true" | "false" | "maybe";
name?: string | undefined;
description?: string | undefined;
type TextData = {
type: "text";
text: string;
name?: string | undefined;
sunnyAmberCrane
@jamisonl
Bot for Cama discord server. To initialize new slash commands, you have to run a separate bit of code. This is for modifying their functionality
HTTP
Bot for Cama discord server. To initialize new slash commands, you have to run a separate bit of code. This is for modifying their functionality
export const handleDiscordInteraction = async (req: Request) => {
// Bump version
let bank = await blob.getJSON("bank");
let bets = await blob.getJSON("bets");
const starting_amount = 5;
if (!bank) {
bank = {};
await blob.setJSON("bank", bank);
if (!bets) {
notif
@rei
An interactive, runnable TypeScript val by rei
Script
export let notif = () => {
console.email("hello mario!");
getWeatherForecast
@cjpais
get weather forecast for a city. pass ?city=Cleveland,OH . e.g.: https://jamiedubs-weatherInCity.web.val.run/?city=brooklyn,ny
HTTP
get weather forecast for a city. pass `?city=Cleveland,OH`. e.g.: https://jamiedubs-weatherInCity.web.val.run/?city=brooklyn,ny
export const getWeatherForecast = async (req: Request) => {
const url = new URL(req.url);
const city = url.searchParams.get("city");
if (!city) {
return new Response("City parameter is required", {
status: 400, // Bad Request
headers: { "Content-Type": "text/plain" },
const weatherApiUrl = `https://wttr.in/${encodeURIComponent(city)}?format=j1`;
try {
duckDB
@adjacent
An interactive, runnable TypeScript val by adjacent
HTTP
export default async function server(request: Request): Promise<Response> {
const url = new URL(request.url);
const dataUrl = url.searchParams.get('url');
if (!dataUrl) {
return new Response('Please provide a URL parameter', { status: 400 });
try {
const db = await Database.create(':memory:');
await db.all('LOAD httpfs');
const result = await db.all(`SELECT * FROM '${dataUrl}' LIMIT 5`);
await db.close();