Search
blushAardwolf
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
HTTP (deprecated)
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
const blog_bookmark = await fetchJSON(
"https://datasette.simonwillison.net/simonwillisonblog/blog_blogmark.json?_labels=on&_shape=objects",
const blog_quotation = await fetchJSON(
"https://datasette.simonwillison.net/simonwillisonblog/blog_quotation.json?_labels=on&_shape=objects",
export default () => Response.json({ blog_bookmark, blog_quotation });
firehoseReadMessagesExample
@healeycodes
// Initially forked from @lukas.sampleFirehose
Script
// Initially forked from @lukas.sampleFirehose
export let firehoseReadMessagesExample = (async () => {
const cborx = await import("https://deno.land/x/cbor@v1.5.2/index.js");
const multiformats = await import("npm:multiformats");
const uint8arrays = await import("npm:uint8arrays");
const { z } = await import("https://deno.land/x/zod@v3.21.4/mod.ts");
const xrpc = await import("npm:@atproto/xrpc");
const cborCodec = await import(
"https://cdn.jsdelivr.net/npm/@ipld/dag-cbor/+esm"
const cborEncode = cborCodec.encode;
religionClickerGame
@roramigator
// This val creates a sarcastic idle clicker game about starting a religion.
HTTP (deprecated)
// This val creates a sarcastic idle clicker game about starting a religion.
/** @jsxImportSource https://esm.sh/react */
function App() {
const [believers, setBelievers] = useState(0);
const [believersPerSecond, setBelieversPerSecond] = useState(0);
const [upgrades, setUpgrades] = useState({
streetPreacher: { count: 0, cost: 10, bps: 0.1 },
cultMeeting: { count: 0, cost: 50, bps: 0.5 },
televangelist: { count: 0, cost: 200, bps: 2 },
megachurch: { count: 0, cost: 1000, bps: 10 },
valTownSearch
@pomdtr
Val Town Search Search for vals using the Github API. Either use the provided UI, or the query param: https://val-town-search.pomdtr.me/search?q=fetchJSON How does it work ? I've wrote about it! Todos [x] Embed the results in the UI [x] Refresh the vals on a cron using a github action [ ] Improve layout on small screens [ ] Support json Accept header [ ] Add pagination params [ ] Allow to filter by authors
HTTP (deprecated)
# [Val Town Search](https://val-town-search.pomdtr.me)
Search for vals using the Github API.
Either use the provided UI, or the query param:
<https://val-town-search.pomdtr.me/search?q=fetchJSON>
## How does it work ?
I've [wrote about it!](https://code-search-is-easy.pomdtr.me)
/** @jsxImportSource npm:preact **/
const githubQuery = (query: string) => encodeURIComponent(`${query} repo:pomdtr/val-town-mirror path:vals/`);
async function handler(req: Request) {
const url = new URL(req.url);
infoboxCrawler
@stevekrouse
@jsxImportSource https://esm.sh/react
HTTP
/** @jsxImportSource https://esm.sh/react */
cytoscape.use(dagre);
const TITLE_SELECTOR = "#firstHeading > span";
function labelPredicate(label) {
return label === "Father" || label === "Mother" || /^Parent/.test(label) || label === "Children" || /^Child/.test(label);
async function* crawlWikipedia(
url: string,
generation: number = 0,
visited: Set<string> = new Set(),
): AsyncGenerator<[string, string, string[], number], void, unknown> {
graffitiWebsite
@andreterron
// Forked from @andreterron.genval
HTTP (deprecated)
export let graffitiWebsite = async (req: express.Request, res: express.Response) => {
const { default: htm } = await import("npm:htm");
const { default: vhtml } = await import("npm:vhtml");
const html = htm.bind(vhtml);
const head = html`<head>
<title>Graffiti Wall</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/htmx.org@1.9.2"></script>
slack_cleaner
@stevekrouse
Paste messages from Slack, get clean markdown This little webapp is intended to make it easier to copy messages from Slack into other places for sharing or archival, with cleaned-up, readable formatting. I hacked it together on valtown with copious help from an LLM over a weekend; please propose changes or edits, as I'm sure I missed many use-cases and edge-cases. This app runs entirely in your browser and does not send your data anywhere.
HTTP (deprecated)
# Paste messages from Slack, get clean markdown
This little webapp is intended to make it easier to copy messages from Slack into other places for sharing or archival, with cleaned-up, readable formatting. I hacked it together on valtown with copious help from an LLM over a weekend; please propose changes or edits, as I'm sure I missed many use-cases and edge-cases. This app runs entirely in your browser and does not send your data anywhere.
![Screenshot 2024-06-24 at 08.49.45@2x.png](https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/3ff8b415-ba7f-439c-458c-5c9c833e4b00/public)
export function slackHTMLToMarkdown(html) {
removeAbsolutePositioning();
const parser = new DOMParser();
const doc = parser.parseFromString(html, "text/html");
let lastSender = "";
let lastTimestamp = "";
let markdown = "";
generate_invoice
@pomdtr
An interactive, runnable TypeScript val by pomdtr
Script
function printHelp() {
console.log("help");
const { _, language, currency } = parseArgs(Deno.args, {
boolean: ["help"],
string: ["language", "currency"],
if (_.length == 0 || !language || !currency) {
printHelp();
Deno.exit(1);
const content = Deno.readTextFileSync(_[0]);
const url = new URL(`https://jsoninvoice.pomdtr.me/invoice/${Base64.encode(content)}`);
marineMoccasinLizard
@kaz
* This app implements a "Would You Rather" game with a ranking system for answers and a progress bar.
* It uses React for the frontend and SQLite for persistent storage on the backend.
* The ranking system updates based on user choices and displays in the Answers tab.
* A progress bar is added to show completion of 20 questions.
HTTP
* This app implements a "Would You Rather" game with a ranking system for answers and a progress bar.
* It uses React for the frontend and SQLite for persistent storage on the backend.
* The ranking system updates based on user choices and displays in the Answers tab.
* A progress bar is added to show completion of 20 questions.
/** @jsxImportSource https://esm.sh/react */
BrowserRouter as Router,
Link,
Route,
Routes,
useLocation,
slackbot
@begoon
A simple Slack chat bot prototype able to reply to mentions, channel messages containing keywords, add reactions and act on the slash commands.
HTTP
A simple Slack chat bot prototype able to reply to mentions, channel messages containing keywords, add reactions and act on the slash commands.
const { env } = Deno;
const SLACK_BOT_TOKEN = env.get("SLACK_BOT_TOKEN");
const SLACK_SIGNING_SECRET = env.get("SLACK_SIGNING_SECRET");
const SLACK_VERIFICATION_TOKEN = env.get("SLACK_VERIFICATION_TOKEN");
async function message(channel: string, text: string, thread_ts?: string) {
return await fetchJSON(
"https://slack.com/api/chat.postMessage",
headers: { "Authorization": `Bearer ${SLACK_BOT_TOKEN}` },
method: "POST",
posthogNode
@andreterron
An interactive, runnable TypeScript val by andreterron
Script
export let posthogNode = (async () => {
const { PostHog } = await import("npm:posthog-node");
const client = new PostHog(process.env.posthog_debug_key, {
host: "https://app.posthog.com",
client.capture({
distinctId: "andre@val.town",
event: "user signed up",
client.on("error", (err) => {
console.log(err);
await client.shutdownAsync();
getModelBuilder
@bluemsn
An interactive, runnable TypeScript val by bluemsn
Script
export async function getModelBuilder(spec: {
type?: "llm" | "chat" | "embedding";
provider?: "openai" | "huggingface";
} = { type: "llm", provider: "openai" }, options?: any) {
const { extend, cond, matches, invoke } = await import("npm:lodash-es");
// Set up LangSmith tracer
// const { Client } = await import("npm:langsmith");
// const { LangChainTracer } = await import("npm:langchain/callbacks");
// const client = new Client({
// apiUrl: "https://api.smith.langchain.com",
react_web_component
@pomdtr
@jsxImportSource https://esm.sh/react
Script
/** @jsxImportSource https://esm.sh/react **/
import r2wc from "https://esm.sh/@r2wc/react-to-web-component";
const Greeting = () => {
return <h1>Hello, World!</h1>;
const WebGreeting = r2wc(Greeting);
customElements.define("web-greeting", WebGreeting);
GTF
@gitneukev
// Fetches a random joke.
Script
export const SAMPLE_JOKE = {
"setup": "What do you call a group of disorganized cats?",
"punchline": "A cat-tastrophe.",
// Fetches a random joke.
function fetchRandomJoke() {
const SAMPLE_JOKE = {
"setup": "What do you call a group of disorganized cats?",
"punchline": "A cat-tastrophe.",
return SAMPLE_JOKE;
primitiveBronzeOwl
@perbhat
@jsxImportSource https://esm.sh/react
HTTP (deprecated)
/** @jsxImportSource https://esm.sh/react */
const ForceScale = () => {
const [force, setForce] = useState(0);
const [weight, setWeight] = useState(0);
const scaleRef = useRef(null);
const baselineForceRef = useRef(0);
const isPressedRef = useRef(false);
useEffect(() => {
const handleForceChange = (e) => {
if (typeof e.webkitForce !== "undefined") {