Search

Results include substring matches and semantically similar vals. Learn more
shreyasmakes avatar
rssFeeds
@shreyasmakes
An interactive, runnable TypeScript val by shreyasmakes
Script
import { inkAndSwitchRssUrl } from "https://esm.town/v/stevekrouse/inkAndSwitchRssUrl";
export const rssFeeds = {
["Ink & Switch"]: inkAndSwitchRssUrl,
["Future of Coding"]:
"https://www.omnycontent.com/d/playlist/c4157e60-c7f8-470d-b13f-a7b30040df73/564f493f-af32-4c48-862f-a7b300e4df49/ac31785
Honestly: "https://feeds.megaphone.fm/RSV2347142881",
["Maggie Appleton"]: "https://maggieappleton.com/rss.xml",
janpaul123 avatar
valle_tmp_44213513371662395868788851793698
@janpaul123
// This script will generate a simple Wordle-like game in HTML with fun and weird CSS.
HTTP (deprecated)
// This script will generate a simple Wordle-like game in HTML with fun and weird CSS.
// It handles basic word validation and checks the status of the current guess.
// For simplicity, it will use a pre-defined secret word.
export default async function wordle(req: Request): Promise<Response> {
const htmlContent = `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
pomdtr avatar
val_town_readme_style
@pomdtr
An interactive, runnable TypeScript val by pomdtr
Script
export default `
-webkit-text-size-adjust: 100%;
tab-size: 4;
font-family: IBM Plex Sans,-apple-system,sans-serif;
font-feature-settings: normal;
font-variation-settings: normal;
--cm-font: Menlo, Consolas, monospace;
color-scheme: dark;
-webkit-font-smoothing: antialiased;
--tw-text-opacity: 1;
stevekrouse avatar
euler1
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Script
import { range } from "https://esm.town/v/stevekrouse/range";
import { sum } from "https://esm.town/v/stevekrouse/sum";
export let euler1 = sum(range(1000).filter(i => i % 3 === 0 || i % 5 === 0))
arpad avatar
umbrellaReminder
@arpad
ā˜”ļø Umbrella reminder if there's rain today Setup Fork this val šŸ‘‰ https://val.town/v/stevekrouse.umbrellaReminder/fork Customize the location (line 8). You can supply any free-form description of a location. āš ļø Only works for US-based locations (where weather.gov covers). How it works Geocodes an free-form description of a location to latitude and longitude ā€“ @stevekrouse.nominatimSearch Converts a latitude and longitude to weather.gov grid ā€“ @stevekrouse.weatherGovGrid Gets the hourly forecast for that grid Filters the forecast for periods that are today and >30% chance of rain If there are any, it formats them appropriately, and sends me an email
Cron
# ā˜”ļø Umbrella reminder if there's rain today
![Screenshot 2023-09-14 at 12.31.32.png](https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/d82916ca-f8d9-4b49-88c6-420ab67a770
## Setup
1. Fork this val šŸ‘‰ https://val.town/v/stevekrouse.umbrellaReminder/fork
2. Customize the `location` (line 8). You can supply any free-form description of a location.
āš ļø Only works for US-based locations (where weather.gov covers).
export const umbrellaReminder = async (arg) => {
if (arg.method) return Response.json("");
let location = "Valencia, Spain"; // <---- customize this line
let [{ lat, lon }] = await nominatimSearch({
tmcw avatar
t
@tmcw
An interactive, runnable TypeScript val by tmcw
Script
export function t(tag: string, args: any = {}, children: any[] = []) {
const func = (...argsOrChildren: any) => {
if (Array.isArray(argsOrChildren[0]))
return func(...argsOrChildren[0], ...argsOrChildren.slice(1));
const args2 = { ...args },
ch2 = [...children];
for (const c of argsOrChildren) {
if (typeof c === "string") ch2.push(c);
else if (typeof c.html === "string") ch2.push(c.html);
else for (const k in c) args2[k] = c[k];
jeffreyyoung avatar
scribbleToDrawing
@jeffreyyoung
An interactive, runnable TypeScript val by jeffreyyoung
HTTP
const replicate = new Replicate({
auth: Deno.env.get("REPLICATE_API_KEY"),
export default serve({
async *handleMessage(req) {
const lastMsg = req.query.at(-1);
if (lastMsg && lastMsg.attachments.at(0)) {
yield events.replace("Generating image");
let success = null;
let error = null;
replicate.run("jagilley/controlnet-scribble:435061a1b5a4c1e26740464bf786efdfa9cb3a3ac488595a2de23e143fdb0117", {
jedahan avatar
variablePower
@jedahan
An interactive, runnable TypeScript val by jedahan
Script
export const variablePower = (request, response) => {
const stylesheet = `
<style>
ul {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 10px;
ul > li {
flex-basis: 200px;
nchau3 avatar
objectToCsv
@nchau3
Converts 2D array of JS objects into CSV formatted string.
Script
Converts 2D array of JS objects into CSV formatted string.
export const objectToCsv = ((data: Object[]) => {
const headerRow = Object.keys(data[0]).join() + "\n";
let bodyRows = "";
data.forEach((element) => {
bodyRows += (Object.values(element).join() + "\n").toString();
return headerRow + bodyRows;
pomdtr avatar
command_template
@pomdtr
#template
Script
#template
import { Command } from "https://esm.town/v/pomdtr/cmdk";
export const helloWorld: Command = async () => {
return {
type: "detail",
detail: {
markdown: "Hello World",
actions: [],
ryanbateman avatar
getShorpyRSS
@ryanbateman
An interactive, runnable TypeScript val by ryanbateman
Script
import { newRSSItems } from "https://esm.town/v/stevekrouse/newRSSItems?v=6";
export async function getShorpyRSS() {
let items = await newRSSItems({
url: "https://feeds.feedburner.com/shorpy?q=rss.xml",
lastRunAt: Date.now() - 7 * 2 * msDay,
if (items?.length) {
for (let item of items) {
console.log(await getLocationEntities(item.description));
saolsen avatar
schema_example
@saolsen
An interactive, runnable TypeScript val by saolsen
Script
export type UserId = string & { readonly UserId: unique symbol };
export const UserId = z
.string()
.startsWith("u_")
.transform((k) => k as UserId);
export const users_table = sqliteTable("users", {
user_id: text("user_id").$type<UserId>().primaryKey(),
username: text("username").unique().notNull(),
first_name: text("first_name"),
last_name: text("last_name"),
chet avatar
TextTransformer
@chet
An interactive, runnable TypeScript val by chet
HTTP (deprecated)
const title = "Text Transformer";
const html = (url: string) => `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>${title}</title>
<style>
body {
shayne avatar
hnTopStoryExample
@shayne
An interactive, runnable TypeScript val by shayne
Script
import { hnTopStory } from "https://esm.town/v/stevekrouse/hnTopStory?v=3";
export const hnTopStoryExample = hnTopStory();
nbbaier avatar
metadata
@nbbaier
An interactive, runnable TypeScript val by nbbaier
Script
import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo";
const { author, name } = extractValInfo(import.meta.url);
export const metadata = name;