Search
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
## Usage
1. Create proxy val for your turso DB (make it private to protect it behind your val town token)
```ts
export default createTursoProxy("<tursoDatabaseUrl>", "<tursoAuthToken>")
2. Wire any existing val to the proxy val
```ts
export function createTursoProxy(databaseUrl: string, authToken: string) {
const client = createClient({
url: `${databaseUrl}?authToken=${Deno.env.get("TURSO_AUTH_TOKEN")}`,
const app = new Hono();
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)
# 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
export async function emailSubscription(req: Request) {
const app = new Hono();
app.get("/", async (c) => {
return c.html(fetchSignupHtml());
log
@alp
An interactive, runnable TypeScript val by alp
Script
import { ping } from "https://esm.town/v/alp/ping";
export const log = async (req, res) => {
await ping();
res.json({
forwardedFor: req.headers["x-forwarded-for"],
remoteAddress: req.connection.remoteAddress,
ip: req.ip,
ghIssueFromNodeId
@augustohp
An interactive, runnable TypeScript val by augustohp
Script
export async function ghIssueFromNodeId(nodeId: string, token: string): Promise<{
id: string;
number: number;
repository: string;
owner: string;
const { Octokit } = await import("npm:@octokit/core");
const octokit = new Octokit({ auth: token });
const graphqlVariables = {
nodeId,
const query = `
emailRandomJoke
@sierralat
// Fetches a random joke.
Cron
// Fetches a random joke.
async function fetchRandomJoke() {
const response = await fetch(
"https://official-joke-api.appspot.com/random_joke",
return response.json();
const randomJoke = await fetchRandomJoke();
const setup = randomJoke.setup;
const punchline = randomJoke.punchline;
// Sends an email with the joke.
export const emailRandomJoke = email({
loaderSampleAudio
@webup
An interactive, runnable TypeScript val by webup
Script
import { getWebLoaderBuilder } from "https://esm.town/v/webup/getWebLoaderBuilder";
export const loaderSampleAudio = (async () => {
const builder = await getWebLoaderBuilder(
"https://storage.googleapis.com/aai-docs-samples/sports_injuries.mp3",
"audio",
{ language_code: "en_us" },
const loader = await builder();
return await loader.load();
svd
@fal
Stable Video Diffusion link to val - https://www.val.town/v/fal/svd import * as fal from "@fal-ai/serverless-client";
const result = await fal.subscribe("fal-ai/fast-svd", {
input: {
image_url: "https://storage.googleapis.com/falserverless/model_tests/svd/rocket.png"
},
logs: true,
onQueueUpdate: (update) => {
if (update.status === "IN_PROGRESS") {
update.logs.map((log) => log.message).forEach(console.log);
}
},
}); https://www.fal.ai/models/svd/playground
Script
## Stable Video Diffusion
link to val - https://www.val.town/v/fal/svd
```js
const result = await fal.subscribe("fal-ai/fast-svd", {
input: {
image_url: "https://storage.googleapis.com/falserverless/model_tests/svd/rocket.png"
export let sd_video = async (
image_url: string,
motion_bucket_id: number = 127,
cond_aug: number = 0.02,
randomCommutes
@jdan
An interactive, runnable TypeScript val by jdan
Script
import { traverse } from "https://esm.town/v/jdan/traverse";
export const randomCommutes = (() => {
for (let i = 0; i < 10; i++) {
console.log(traverse(dailyCommute));
emailMe
@dmac99
An interactive, runnable TypeScript val by dmac99
Script
import { welcomeEmail } from "https://esm.town/v/rodrigotello/welcomeEmail?v=142";
export let emailMe = console.email({
html: welcomeEmail,
subject: "Welcome to Val Town",
heapify
@aeschylus
An interactive, runnable TypeScript val by aeschylus
Script
export let heapify = (arr) => {
// maxHeap
const swapDown = (arr, n, i) => {
// Recursively swap entries if they are less than their children.
// The first index to be checked will be the last non-leaf (floor(n/2 - 1)),
// since we only really call this from insert and delete.
let largest = i; // assume the current index is the largest.
const left = 2 * i + 1; // because math (binary tree)
const right = 2 * i + 2; // because math
// Check if left child of current node is greater, satisfying the heap
goldVulture
@yawnxyz
An interactive, runnable TypeScript val by yawnxyz
Script
export function currentDate() {
return new Date();
hackerNewsAuthors
@dustingetz
An interactive, runnable TypeScript val by dustingetz
Script
export let hackerNewsAuthors = ["stevekrouse", "dustingetz"];
linkHandlers
@iamseeley
An interactive, runnable TypeScript val by iamseeley
Script
/** @jsx jsx */
/** @jsxFrag Fragment */
export const addLinkHandler = async (c) => {
try {
const payload = await c.get('jwtPayload');
const body = await c.req.parseBody();
const label = body.label;
const url = body.url;
if (!label || !url) {
return c.json({ error: 'Label and URL are required' }, 400);