Search

Results include substring matches and semantically similar vals. Learn more
nickaggarwal avatar
eagerIndigoPig
@nickaggarwal
Slack scout sends a slack notification every time your keywords are mentioned on Twitter, Hacker News, or Reddit. Get notified whenever you, your company, or topics of interest are mentioned online. Built with Browserbase . Inspired by f5bot.com . Full code tutorial . Getting Started To run Slack Scout, you’ll need a Browserbase API key Slack Webhook URL: setup here Twitter Developer API key Browserbase Browserbase is a developer platform to run, manage, and monitor headless browsers at scale. We’ll use Browserbase to navigate to, and scrape our different news sources. We’ll also use Browserbase’s Proxies to ensure we simulate authentic user interactions across multiple browser sessions . Get started with Browserbase for free here . Twitter We’ve decided to use the Twitter API to include Twitter post results. It costs $100 / month to have a Basic Twitter Developer account. If you decide to use Browserbase, we can lend our token. Comment below for access. Once you have the SLACK_WEBHOOK_URL , BROWSERBASE_API_KEY , and TWITTER_BEARER_TOKEN , input all of these as Val Town Environment Variables . Project created by Sarah Chieng and Alex Phan 💌
Cron
### Browserbase
e’s Proxies](https://docs.browserbase.com/features/stealth-mode#proxies-and-residential-ips) to ensure we simulate authentic
Get started with Browserbase for free [here](https://www.browserbase.com/sign-up).
yawnxyz avatar
gettingOpenAiStreamingtoWork
@yawnxyz
Blatantly copied code from theseephist's webgen: https://www.val.town/v/thesephist/webgen. Couldn't get streaming to work in valtown myself!!
HTTP (deprecated)
writer.write(textEncoder.encode(text)); // Remove 'await' here
writer.close(); // This can be awaited if needed
// Send the readable stream back to the client
return new Response(readable, {
headers: {
triptych avatar
litExample
@triptych
lit Lit is kind of like Google's answer to React: it's a little more reliant on browser APIs like custom elements and the shadow DOM, a little less 'magic', like using JSX. This is an example of using Lit and rendering it straight to a string, which is something that's recently popular. It works pretty well, right off the bat: Lit provides nice ESM modules and a pretty smooth workflow!
Script
# lit
t](https://lit.dev/docs/ssr/server-usage/) is kind of like Google's answer to React: it's a little more reliant on browser AP
This is an example of using Lit and rendering it straight to a string, which is something that's recently popular. It works p
iamseeley avatar
threedEmoji
@iamseeley
3️⃣ 🇩 create 3d emojis and text with three.js example usage: include a container in your HTML <div id="3d-emoji" style="width: 300px; height: 300px;"></div> call the function after the DOM has loaded import { create3DEmoji } from 'https://esm.town/v/iamseeley/threedEmoji'; document.addEventListener('DOMContentLoaded', () => { create3DEmoji('😊', 300, 300); });
Script
const planeHeight = planeWidth / aspectRatio;
const geometry = new THREE.PlaneGeometry(planeWidth, planeHeight);
const material = new THREE.MeshBasicMaterial({ map: texture, side: THREE.DoubleSide, transparent: true });
const plane = new THREE.Mesh(geometry, material);
scene.add(plane);
canpolat avatar
createQuotePost
@canpolat
An interactive, runnable TypeScript val by canpolat
Script
auth: string;
//const { LemmyHttp } = await import("npm:lemmy-js-client");
const { LemmyHttp } = await import("npm:lemmy-js-client@0.18.1");
let client = new LemmyHttp(`https://${instance}`, {
fetchFunction: fetch,
try {
const ret = await client.createPost({
community_id: communityId,
fossforlife avatar
mediumToMarkdown
@fossforlife
// Altered from https://github.com/ericclemmons/medium-to-markdown
Script
next.end += prefix.length + suffix.length;
return;
// Markup inside has to take account of prefix + suffix
next.start += prefix.length;
next.end += prefix.length;
pomdtr avatar
createTursoProxy
@pomdtr
Usage Create proxy val for your turso DB (make it private to protect it behind your val town token) import {createTursoProxy} from "https://esm.town/v/pomdtr/createTursoProxy" export default createTursoProxy("<tursoDatabaseUrl>", "<tursoAuthToken>") Wire any existing val to the proxy val import { setEnv } from "https://esm.town/v/pomdtr/setEnv"; // use my private proxy setEnv("VALTOWN_API_URL", "<proxy-url>"); // wire sqlite explorer to a turso db ! const { handler } = await import("https://esm.town/v/nbbaier/sqliteExplorerApp"); export default handler;
Script
import { Hono } from "jsr:@hono/hono";
import { createClient } from "npm:@libsql/client";
export function createTursoProxy(databaseUrl: string, authToken: string) {
const client = createClient({
url: `${databaseUrl}?authToken=${Deno.env.get("TURSO_AUTH_TOKEN")}`,
return new Response("No statements", { status: 400 });
const res = await client.batch(statements, mode);
return new Response(JSON.stringify(res));
return new Response("No statement", { status: 400 });
const res = await client.execute(statement);
return new Response(JSON.stringify(res));
fal avatar
creative_upscaler
@fal
Creative Upscaler link to val - https://www.val.town/v/fal/creative_upscaler Usage const upscaledImage = @fal.creative_upscaler("an owl", "https://storage.googleapis.com/falserverless/model_tests/upscale/owl.png") Usage import fal from "npm:@fal-ai/serverless-client"; const result = await fal.subscribe("fal-ai/creative-upscaler", { input: { prompt: "an owl", image_url: "https://storage.googleapis.com/falserverless/model_tests/upscale/owl.png", }, logs: true, onQueueUpdate: (update) => { if (update.status === "IN_PROGRESS") { update.logs.map((log) => log.message).forEach(console.log); } }, }); https://www.fal.ai/models/creative-upscaler
Script
```js
import fal from "npm:@fal-ai/serverless-client";
const result = await fal.subscribe("fal-ai/creative-upscaler", {
import fal from "npm:@fal-ai/serverless-client";
export let creativeUpscaler = async (
prompt: string,
pomdtr avatar
github_oauth_proxy
@pomdtr
Proxy Server for Github Oauth The mechanism is inspired from https://indielogin.com/
Script
import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo";
import { Hono } from "npm:hono";
const clientID = Deno.env.get("GITHUB_CLIENT_ID");
const clientSecret = Deno.env.get("GITHUB_CLIENT_SECRET");
const app = new Hono();
export default app.fetch;
iamseeley avatar
oceanTheme
@iamseeley
🌊 🐟 An under the sea resume theme 🐚 🐙
Script
li {
margin-bottom: 10px;
aside {
margin-top: 8px;
margin-bottom: 8px;
.fish {
position: absolute;
right: -50px; /* Start outside the viewport */
animation: swim linear infinite;
@keyframes swim {
petermillspaugh avatar
emailCourseCreator
@petermillspaugh
Email-based (spaced repetition) course creation tool 🏗️ Work-in-progress! 🏗️ The idea is to create a reusable course generator Val designed with effective, research-backed learning techniques in mind. That includes techniques like spaced repetition (via an interval between email lessons), retrieval practice (quizzing and fill-in-the-blank), elaboration and reflection (writing exercises). The Val(s) will include: Email signup and verification Template to fill in with course content SQLite tables to store students and track progress Cron job to send lessons to students As the first use case for this generalizable course creator, I plan to make a course about Make It Stick , which is a practical book about learning research that gave me the idea. I'm writing more about the implementation on my digital garden , which is also where you'll find the signup form .
HTTP (deprecated)
import { sqlite } from "https://esm.town/v/std/sqlite?v=4";
import { Hono } from "npm:hono";
import { JSX } from "npm:react";
export async function emailSubscription(req: Request) {
const app = new Hono();
text: `Verification complete for ${email}'s subscription to: Make It Stick (in 10 days, via email)`,
return Response.json({ confirmed: true, message: "Verified email address." });
* TODO: POST requests are blocked for security reasons on mobile email clients.
* I could use a GET request with a req body, but that's a hack/anti-pattern.
* I don't want to move the form to a webpage because it should be in the lesson flow.
andreterron avatar
refreshTwitterToken
@andreterron
An interactive, runnable TypeScript val by andreterron
Script
export async function refreshTwitterToken(
{ refresh_token, client_id, client_secret }: {
refresh_token: string;
client_id: string;
client_secret: string;
const url = "https://api.twitter.com/2/oauth2/token";
refresh_token,
client_id,
return fetchJSON(url, {
"Content-Type": "application/x-www-form-urlencoded",
...basicAuthorization(client_id, client_secret),
body: body.toString(),
pomdtr avatar
lit_example_component
@pomdtr
An interactive, runnable TypeScript val by pomdtr
Script
constructor() {
super();
// Declare reactive properties
this.name = "World";
// Render the UI as a function of component state
ianvph avatar
capturePostHogEvent
@ianvph
An interactive, runnable TypeScript val by ianvph
Script
const { PostHog } = await import("npm:posthog-node");
const client = new PostHog(key, {
host: host,
client.capture({
distinctId: distinct_id,
timestamp: timestamp,
client.on("error", (err) => {
console.log(err);
// flush events because this is short-lived process
await client.shutdown();
return "Event captured";
samwillis avatar
pglite
@samwillis
PGlite ❤️ Val Town PGlite is a WASM Postgres build packaged into a TypeScript client library that enables you to run Postgres in the browser, Node.js, Bun and Deno, with no need to install any other dependencies. It is only 3mb gzipped and has support for many Postgres extensions, including pgvector. Read more about PGlite here: http://pglite.dev GitHub: http://github.com/electric-sql/pglite
HTTP
# PGlite ❤️ Val Town
lite](http://pglite.dev) is a WASM Postgres build packaged into a TypeScript client library that enables you to run Postgres
Read more about PGlite here: http://pglite.dev