Search

Results include substring matches and semantically similar vals. Learn more
janpaul123 avatar
valle_tmp_459423574352421057264033168224449
@janpaul123
// Initialize sample stories and store them in blob storage
HTTP (deprecated)
// Initialize sample stories and store them in blob storage
const SAMPLE_STORIES_KEY = "hn_sample_stories";
async function initializeSampleStories() {
const existingStories = await blob.getJSON(SAMPLE_STORIES_KEY);
if (!existingStories) {
const sampleStories = Array.from({ length: 30 }).map((_, idx) => ({
id: idx + 1,
title: `Sample Story ${idx + 1}`,
url: `https://example.com/story${idx + 1}`,
votes: Math.floor(Math.random() * 100),
hlobil avatar
sqliteExplorerApp
@hlobil
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 (v86) by forking this val: Authentication Login to your SQLite Explorer with password authentication with your Val Town API Token as the password. Todos / Plans [ ] improve error handling [ ] improve table formatting [ ] sticky table headers [x] 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 [ ] add refresh to table list sidebar after CREATE/DROP/ALTER statements [ ] add automatic execution of initial select query on double click [x] add views to the sidebar [ ] add triggers to sidebar [ ] add upload from SQL, CSV and JSON [ ] add ability to connect to a non-val town Turso database [x] fix wonky sidebar separator height problem (thanks to @stevekrouse) [x] make result tables scrollable [x] add export to CSV, and JSON (CSV and JSON helper functions written in this val . Thanks to @pomdtr for merging the initial version!) [x] add listener for cmd+enter to submit query
HTTP (deprecated)
# SQLite Explorer
View and interact with your Val Town SQLite data. It's based off Steve's excellent [SQLite Admin](https://www.val.town/v/stev
![image.webp](https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/c8e102fd-39ca-4bfb-372a-8d36daf43900/public)
## Install
Install the latest stable version (v86) by forking this val:
[![Install Stable Release (v86)](https://stevekrouse-button.express.val.run/Install%20Stable%20Release%20(v81))](https://www.
/** @jsxImportSource https://esm.sh/hono@latest/jsx **/
EditorSection,
MockTable,
Separator,
stevekrouse avatar
dateme_browse_react
@stevekrouse
@jsxImportSource https://esm.sh/react@18.2.0
Script
/** @jsxImportSource https://esm.sh/react@18.2.0 */
function absoluteURL(url) {
if (url.startsWith("http://") || url.startsWith("https://"))
return url;
else return "https://" + url;
let headers = [
"Name",
"Age",
"Gender",
"InterestedIn",
movienerd avatar
originalEmeraldPython
@movienerd
* This program creates a movie recommendation system based on moods. * It uses OpenAI to generate movie recommendations based on the user's selected mood and feedback. * The program uses React for the frontend and handles state management for user interactions. * It uses the Val Town OpenAI proxy for backend API calls. * A "More moods" button has been added to dynamically expand the list of available moods.
HTTP
* This program creates a movie recommendation system based on moods.
* It uses OpenAI to generate movie recommendations based on the user's selected mood and feedback.
* The program uses React for the frontend and handles state management for user interactions.
* It uses the Val Town OpenAI proxy for backend API calls.
* A "More moods" button has been added to dynamically expand the list of available moods.
/** @jsxImportSource https://esm.sh/react */
type Mood = string;
type Feedback = "Liked" | "Disliked" | "Not Watched";
interface Movie {
title: string;
pomdtr avatar
popcorn
@pomdtr
An interactive, runnable TypeScript val by pomdtr
HTTP (deprecated)
const app = new Hono();
app.get("/", (c) => {
const list: popcorn.List = [];
list.push({
title: "List Blobs",
icon: "BeakerIcon",
actions: [{
title: "List Blobs",
type: "push",
page: "/blobs",
liamdanielduffy avatar
myReactApp
@liamdanielduffy
An interactive, runnable TypeScript val by liamdanielduffy
Script
import { addReactFromCDN } from "https://esm.town/v/liamdanielduffy/addReactFromCDN";
export function myReactApp() {
const loadReact = addReactFromCDN();
const myReactComponent = myReactComponent2();
const initializeReactApp = initializeReactApp2();
return [loadReact, myReactComponent, initializeReactApp].join(" ");
politelyinvinciblepointer avatar
increaserantcounter
@politelyinvinciblepointer
An interactive, runnable TypeScript val by politelyinvinciblepointer
Script
let { rantcounter } = await import("https://esm.town/v/politelyinvinciblepointer/rantcounter");
export function increaserantcounter() {
rantcounter++;
pomdtr avatar
sunbeam
@pomdtr
An interactive, runnable TypeScript val by pomdtr
HTTP (deprecated)
const script = (webEndpoint) =>
`#!/bin/sh
if [ $# -eq 0 ]; then
exec sunbeam fetch ${shlex.quote(webEndpoint)}
fi
exec sunbeam -d "@-" -X POST ${shlex.quote(webEndpoint)}
export default function(req: Request) {
const [, author, name] = new URL(req.url).pathname.split("/");
if (!author || !name) {
return new Response("Could not extract val author or name from request", {
nilslice avatar
importText2PngHandler
@nilslice
An interactive, runnable TypeScript val by nilslice
HTTP (deprecated)
import handler from "https://esm.town/v/nilslice/text2png";
export default async function(req: Request): Promise<Response> {
const url = new URL(req.url);
url.searchParams.set("text", "hello from the other val");
url.searchParams.set("color", "green");
url.searchParams.set("font_size", "100");
let r = new Request(url);
return handler(r);
stevekrouse avatar
upstash
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Script
const { Redis } = await import("npm:@upstash/redis");
const redis = new Redis({
url: process.env.upstashURL,
token: process.env.upstashToken,
export let upstash = async (key: string, value?: any) => {
if (!value) {
return redis.get(key);
else {
await redis.set(key, value);
return value;
just_be avatar
content_addressable_js
@just_be
Content Addressable JavaScript This is a project I'm working on at the Recurse Center for Impossible Day. The aim is to build a module system that's a little bit similar to how Unison works. Follow along on my site .
Script
# Content Addressable JavaScript
This is a project I'm working on at the [Recurse Center](https://recurse.com) for Impossible Day. The aim is to build a modul
system that's a little bit similar to how [Unison](https://www.unison-lang.org/docs/the-big-idea/) works.
Follow along on [my site](https://just-be.dev/rc/impossible-day).
* Can't do content addressability without a good hash function
* String -> SHA256 hash
const hash = (content: string) =>
crypto.subtle
.digest("SHA-256", new TextEncoder().encode(content))
.then((b) => new Uint8Array(b))
vawogbemi avatar
dateme_layout
@vawogbemi
@jsxImportSource npm:hono@3/jsx
Script
/** @jsxImportSource npm:hono@3/jsx */
const tabs = { "/": "Home", "/browse": "Browse", "/faq": "FAQ" };
export default function({ activeTab, children }: PropsWithChildren<{ activeTab: string }>) {
return (
<html>
<head>
<title>I'm Looking for a Man In Finance</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script src="https://cdn.tailwindcss.com" />
</head>
stevedylandev avatar
twemoji
@stevedylandev
* modified version of https://unpkg.com/twemoji@13.1.0/dist/twemoji.esm.js.
Script
* modified version of https://unpkg.com/twemoji@13.1.0/dist/twemoji.esm.js.
/* ! Copyright Twitter Inc. and other contributors. Licensed under MIT */
// this file added in: https://github.com/open-sauced/opengraph/issues/50
const U200D = String.fromCharCode(8205);
const UFE0Fg = /\uFE0F/g;
export function getIconCode (char: string) {
return toCodePoint(!char.includes(U200D) ? char.replace(UFE0Fg, "") : char);
function toCodePoint (unicodeSurrogates: string) {
const r = [];
let c = 0;
feynman avatar
myApi
@feynman
An interactive, runnable TypeScript val by feynman
Script
export async function myApi(name) {
const got = await import("got");
const res = await got.post("http://34.87.31.113:3000/infer", {
json: {
input: [["0", 24], ["a", 28], ["b", 68], ["0", 56], ["c", 1], ["d", 55]],
direction: "vertical",
}).json();
return res;
iamseeley avatar
resumeHandler
@iamseeley
📄 hello, resume Creating, customizing, and hosting resumes can get complicated and time-consuming. This project aims to simplify that process and maybe make it a little more enjoyable. Follow the steps in your resumeConfig to get started . Happy job hunting! 💼✨ Thanks to @nbbaier for the great feedback and resumeValidator ! Also, big thanks to Thomas Davis for JSON Resume Standard!
HTTP (deprecated)
## 📄 hello, resume
Creating, customizing, and hosting resumes can get complicated and time-consuming. This project aims to simplify that process
*Follow the steps in your **resumeConfig** to get started*.
Happy job hunting! 💼✨
Thanks to [@nbbaier](https://www.val.town/u/nbbaier) for the great feedback and [resumeValidator](https://www.val.town/v/nbba
Also, big thanks to [Thomas Davis](https://github.com/thomasdavis) for JSON Resume Standard!
export default async function resumeHandler(req: Request): Promise<Response> {
if (req.method === 'GET') {
try {
const config = await resumeSetup(resumeConfig);