Search

Results include substring matches and semantically similar vals. Learn more
bentossell avatar
hnFollowApp
@bentossell
// Forked from @stevekrouse.hnFollowApp
Cron
export default async function({ lastRunAt }) {
let posts = await hnLatestPosts({
query: "AI, LLM",
// lastSyncTime: lastRunAt,
search_by_date: true,
// for each post get the number of upvotes from the hackernews api using fetch
for (let post of posts) {
let res = await fetch(`https://hacker-news.firebaseio.com/v0/item/${post.objectID}.json`);
post.upvotes = await res.json();
let { html, subject } = await hnEmail({ posts });
webup avatar
loaderSampleAudioChinese
@webup
An interactive, runnable TypeScript val by webup
Script
import { getWebLoaderBuilder } from "https://esm.town/v/webup/getWebLoaderBuilder";
export const loaderSampleAudioChinese = (async () => {
const builder = await getWebLoaderBuilder(
"https://github.com/webup/langchain-js-quickstart/raw/master/data/podcast.m4a",
"audio",
// https://www.assemblyai.com/docs/Concepts/supported_languages
{ language_code: "zh" },
const loader = await builder();
return await loader.load();
petermillspaugh avatar
sendNewsletterReminder
@petermillspaugh
Val Town email subscriptions: newsletter reminder Cousin Val to @petermillspaugh/emailSubscription for emailing yourself a reminder to send your next newsletter. Since this Val is public, anyone can run it. I've commented out the function body that actually emails me to prevent anyone from spamming me, but you can fork this as a private Val to set a cron reminder.
Cron
# Val Town email subscriptions: newsletter reminder
Cousin Val to [@petermillspaugh/emailSubscription](https://www.val.town/v/petermillspaugh/emailSubscription) for emailing you
Since this Val is public, anyone can run it. I've commented out the function body that actually emails me to prevent anyone f
import { email } from "https://esm.town/v/std/email?v=11";
export async function sendNewsletterReminder(interval: Interval) {
// await email({
// subject: `Reminder to prepare newsletter #${newsletters.length + 1}`,
// html: `One week left to write up the next newsletter!`,
stevekrouse avatar
insecureSSLCertExample
@stevekrouse
This is an example call of @stevekrouse/insecureFetch
Script
This is an example call of @stevekrouse/insecureFetch
import { insecureFetch } from "https://esm.town/v/stevekrouse/insecureFetch";
const url = "https://assignment-api.uspto.gov/patent/basicSearch?query=1234567&fields=main&rows=20";
const data = await insecureFetch(url);
const text = await data.text();
console.log(text);
rishabhparikh avatar
easyAQI
@rishabhparikh
easyAQI Get the Air Quality Index (AQI) for a location via open data sources. It's "easy" because it strings together multiple lower-level APIs to give you a simple interface for AQI. Accepts a location in basically any string format (ie "downtown manhattan") Uses Nominatim to turn that into longitude and latitude Finds the closest sensor to you on OpenAQ Pulls the readings from OpenAQ Calculates the AQI via EPA's NowCAST algorithm Uses EPA's ranking to classify the severity of the score (ie "Unhealthy for Sensitive Groups") It uses blob storage to cache the openai location id for your location string to skip a couple steps for the next time. Example usage @stevekrouse.easyAQI({ location: "brooklyn navy yard" }) // Returns { "aqi": 23.6, "severity": "Good" } Forkable example: val.town/v/stevekrouse.easyAQIExample Also useful for getting alerts when the AQI is unhealthy near you: https://www.val.town/v/stevekrouse.aqi
Script
# easyAQI
Get the Air Quality Index (AQI) for a location via open data sources.
It's "easy" because it strings together multiple lower-level APIs to give you a simple interface for AQI.
1. Accepts a location in basically any string format (ie "downtown manhattan")
2. Uses [Nominatim](https://nominatim.org/) to turn that into longitude and latitude
3. Finds the closest sensor to you on [OpenAQ](https://openaq.org/)
const cacheKey = location => "easyAQI_locationID_cache_" + encodeURIComponent(location);
export async function easyAQI({ location }: {
location: string;
let openAQLocation = await blob.getJSON(cacheKey(location));
ulve avatar
sqlite_explorer
@ulve
An interactive, runnable TypeScript val by ulve
HTTP (deprecated)
export { default } from "https://esm.town/v/nbbaier/sqliteExplorerApp?v=81";
valtism avatar
valTownDailyInspo
@valtism
An interactive, runnable TypeScript val by valtism
Script
import { valTownInspirationEmail } from "https://esm.town/v/rodrigotello/valTownInspirationEmail?v=79";
export async function valTownDailyInspo() {
return await valTownInspirationEmail();
cenkalti avatar
myApi
@cenkalti
An interactive, runnable TypeScript val by cenkalti
Script
export function myApi(name) {
return "hi " + name;
sdan avatar
githubEvents
@sdan
An interactive, runnable TypeScript val by sdan
Script
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
// GitHub events
export let githubEvents = fetchJSON(
"https://api.github.com/users/stevekrouse/events",
marksteve avatar
watchEpicTvDiscounts
@marksteve
An interactive, runnable TypeScript val by marksteve
Cron
import { epicTvWatchList } from "https://esm.town/v/marksteve/epicTvWatchList";
export const watchEpicTvDiscounts = async (interval: Interval) => {
const discounts = [];
for (
let [user, { secret, watchList }] of Object.entries(
epicTvWatchList,
discounts.push(await checkEpicTvDiscounts(user, secret, watchList));
return discounts;
vandyand avatar
rateArticleRelevance
@vandyand
An interactive, runnable TypeScript val by vandyand
Script
export const rateArticleRelevance = async (interests: string, article: any) => {
const { default: OpenAI } = await import("npm:openai");
const openai = new OpenAI({
apiKey: untitled_tealCoral.OPENAI_API_KEY,
try {
const prompt = `I am interested in ${interests}.
Am I going to like this article?
Article Title: ${article.title}.
Article Description: ${article.description}.
Give a score from 0 to 10. Why did you give this score? Respond with the score only.
janpaul123 avatar
valle_tmp_59342510692095097966010158625245
@janpaul123
// This val responds with an HTML form to input the user's name and greets them
HTTP (deprecated)
// This val responds with an HTML form to input the user's name and greets them
export default async function(req: Request): Promise<Response> {
const htmlResponse = `
<form action="/" method="POST">
<label for="name">Enter your name:</label><br>
<input type="text" id="name" name="name"><br>
<input type="submit" value="Submit">
</form>
return new Response(htmlResponse, {
headers: { "Content-Type": "text/html" },
pomdtr avatar
publicRouteTest
@pomdtr
An interactive, runnable TypeScript val by pomdtr
HTTP (deprecated)
import { verifyUserEmail } from "https://esm.town/v/pomdtr/verifyUserEmail";
export default lastlogin(() => {
return new Response("Hi!");
verifyEmail: verifyUserEmail,
public_routes: ["/", "/public/*"],
elixory avatar
consoleEmailEx
@elixory
// email yourself as easily as logging to the console
Script
// email yourself as easily as logging to the console
export let consoleEmailEx = (() => {
console.email("message"); // any JSON object can be the message
console.email({ html: "<h1>hello html emails!</h1>" }); // you can send HTML emails
console.email({ hi: "there" }, "Subject Line"); // optional second arg is the subject line
console.email({ html: "<b>hi!</b>", subject: "Subject accepted here too" });
ptr avatar
getHolidays
@ptr
An interactive, runnable TypeScript val by ptr
Script
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
export const getHolidays = (country, year = new Date().getFullYear()) => {
try {
return fetchJSON(
`https://date.nager.at/api/v2/publicholidays/${year}/${country}`
} catch (err) {
return null;