Search

Results include substring matches and semantically similar vals. Learn more
vladimyr avatar
insecureFetch
@vladimyr
Insecure SSL Cert Fetch This will be useful if you're getting a invalid peer certificate: UnknownIssuer error . If you need to make a fetch request to a website with a dubious or non-standard SSL certificate, you can use this proxy we made on Cloudflare workers (which doesn't verify SSL certs): https://unsecure-fetch.val-town.workers.dev/ 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)
Script
export function insecureFetch(input: string | URL | Request, init?: RequestInit) {
const origReq = new Request(input, init);
const proxyURL = new URL("https://unsecure-fetch.val-town.workers.dev");
chadwhitacre avatar
multiplayerCircles
@chadwhitacre
Multiplayer Circles Move circles around. State is synced with the server. Open a window in another tab and watch the circles update as you move them .
HTTP
// await sqlite.execute({ sql: `INSERT INTO draggable_circles VALUES (?, ?, ?)`, args: [c.index, c.x, c.y] });
function parseResultSet<T>(row: ResultSet): T[] {
return row.rows.map((r) => Object.fromEntries(r.map((c, i) => [row.columns[i], c]))) as T[];
return parseResultSet<Circle>(await sqlite.execute("select * from draggable_circles"));
function diffCircles(array1: Circle[], array2: Circle[]): Circle[] {
const changes: Circle[] = [];
const drag = (() => {
function dragstarted() {
d3.select(this).attr("stroke", "black");
function dragged(event, d) {
d3.select(this).raise().attr("cx", d.x = event.x).attr("cy", d.y = event.y);
function dragended() {
const x = d3.select(this).attr("cx");
.on("click", clicked);
function clicked(event, d) {
if (event.defaultPrevented) return; // dragged
nickgolden avatar
ipqsScoreChangeAlert
@nickgolden
An interactive, runnable TypeScript val by nickgolden
Cron
const ipAddress = "8.8.8.8";
const ipDataName = "googleIpqsData";
async function sendEmail(oldData, newData) {
const emailBody = `The IPQS score for the IP address "${ipAddress}" has changed.
Old evaluation:
${JSON.stringify(newData, null, 2)}`;
await email({ subject: `IPQS score changed: ${ipAddress}`, text: emailBody });
export async function checkIp() {
const result = await fetch(`https://ipqualityscore.com/api/json/ip/${ipqsApiKey}/${ipAddress}`);
const newData = await result.json();
Valtown12 avatar
NoteSphereApp
@Valtown12
@jsxImportSource https://esm.sh/react@18.2.0
HTTP
reminder?: Date;
function App() {
// State management
console.error("Error deleting note:", error);
// New PDF Export Function
const exportNoteToPDF = () => {
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request): Promise<Response> {
return new Response(`
sebch avatar
textExtractorAndEmail
@sebch
An interactive, runnable TypeScript val by sebch
HTTP
import { email } from "https://esm.town/v/std/email";
import { parse } from "https://esm.sh/node-html-parser";
async function extractWebsiteText(url: string): Promise<string> {
const response = await fetch(url, {
headers: {
.join('\n');
return textContent;
export default async function server(request: Request): Promise<Response> {
const url = new URL(request.url);
const websiteUrl = url.searchParams.get('url');
rohaaaan avatar
valentine
@rohaaaan
Hello!!! Feel free to mess around with this val and make it your own :). Just click on "Fork" in the top right. You can change the phrases that show up as you click no, you can change the firstImg and secondImg, maybe even add more images. And you can also change the colors and any of the text on the screen! Have fun with it and hopefully your crush says yes hehe.
HTTP
"kuchi kuchi babyyy pwease",
function App() {
const [noClicks, setNoClicks] = useState(0);
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request): Promise<Response> {
return new Response(
stevekrouse avatar
parseHTML
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Script
export async function parseHTML(text) {
const { DOMParser } = await import(
"https://deno.land/x/deno_dom/deno-dom-wasm.ts"
yacosta738 avatar
aqi
@yacosta738
AQI Alerts Get email alerts when AQI is unhealthy near you. Set up Click Fork Change location (Line 4) to describe your location. It accepts fairly flexible English descriptions which it turns into locations via nominatim's geocoder API . Click Run Background This val uses nominatim's geocoder to get your lat, lon, and air quality data from OpenAQ. It uses EPA's NowCast AQI Index calculation and severity levels. Learn more: https://www.val.town/v/stevekrouse.easyAQI
Cron
import { email } from "https://esm.town/v/std/email?v=9";
import { easyAQI } from "https://esm.town/v/stevekrouse/easyAQI";
export async function aqi(interval: Interval) {
const location = "46025, Benicalap, Valencia, Spain"; // <-- change to place, city, or zip code
const data = await easyAQI({ location });
janpaul123 avatar
valle_tmp_328293536271528244631103783931838
@janpaul123
// This val retrieves the weather in Brooklyn, NY using the MetaWeather API
HTTP
// This val retrieves the weather in Brooklyn, NY using the MetaWeather API
export default async function main(req: Request): Promise<Response> {
const response = await fetch("https://www.metaweather.com/api/location/2459115/");
const weatherData = await response.json();
stevekrouse avatar
cron_client_react_fork
@stevekrouse
CronGPT This is a minisite to help you create cron expressions, particularly for crons on Val Town. It was inspired by Cron Prompt , but also does the timezone conversion from wherever you are to UTC (typically the server timezone). Tech Hono for routing ( GET / and POST /compile .) Hono JSX HTML (probably overcomplicates things; should remove) @stevekrouse/openai, which is a light wrapper around @std/openai TODO [ ] simplify by removing HTMX (try doing the form as a GET request, manual JS script, or client side react) [ ] make the timezone picker better (fewer options, searchable) [ ] add a copy button?
HTTP
* HTML (probably overcomplicates things; should remove)
* @stevekrouse/openai, which is a light wrapper around @std/openai
## TODO
import React, { useState } from "https://esm.sh/react@18.2.0";
import { chat } from "https://esm.town/v/stevekrouse/openai?v=19";
import react_http from "https://esm.town/v/stevekrouse/react_http?v=6";
export default function(req: Request) {
const url = new URL(req.url);
return new Response("Not found", { status: 404 });
export function App() {
const browserTZ = Intl.DateTimeFormat().resolvedOptions().timeZone;
const [cron, setCron] = useState("0 16 * * 1-5");
const onSubmit: React.FormEventHandler<HTMLFormElement> = async function(e) {
e.preventDefault();
<a href={href} className="text-blue-500 hover:text-blue-700" target="_blank" rel="noopener noreferrer">{children}</a>
function Cron({ cron, timezone }) {
let translation;
</div>
async function compile(req: Request) {
const form = await req.formData();
hydeptsa avatar
cal
@hydeptsa
An interactive, runnable TypeScript val by hydeptsa
HTTP
export default async function server(request: Request): Promise<Response> {
console.log("request", request);
eighteenMonthsAgo.setMonth(eighteenMonthsAgo.getMonth() - 18);
console.log("calling notion api with time:");
console.log(eighteenMonthsAgo.toISOString().split("T")[0]);
return new Response(`Error generating calendar feed: ${error.message}`, { status: 500 });
function generateICalFeed(events) {
const icalLines = [
return icalLines.join("\r\n");
function formatICalDate(dateString) {
if (!dateString) return "";
Meon_val avatar
first_code
@Meon_val
Hello!!! Feel free to mess around with this val and make it your own :). Just click on "Fork" in the top right. You can change the phrases that show up as you click no, you can change the firstImg and secondImg, maybe even add more images. And you can also change the colors and any of the text on the screen! Have fun with it and hopefully your crush says yes hehe.
HTTP
"Please don't do this to me, I'm fragile",
function App() {
const [noClicks, setNoClicks] = useState(0);
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request): Promise<Response> {
return new Response(
thesephist avatar
prism_feature_notifications
@thesephist
Sparse autoencoder feature of the day email This Val sends a daily notification email at the start of every day with a random high confidence (> 0.8) feature drawn from my sparse autoencoders project that tries to find interpretable directions in the latent space of embedding models. It sends you an email with a brief description of the feature and a link to view more. Here's an example email from this Val: Every time you run it, you'll get a different feature. By default, this uses the lg-v6 model, which I think is a good one to start with, but this may change in the future as I train better feature dictionaries!
Cron
const confidenceThreshold = 0.8;
function randomlyPickFeature(featuresAboveConfidenceThreshold) {
return featuresAboveConfidenceThreshold[Math.floor(Math.random() * featuresAboveConfidenceThreshold.length)];
function getFeatureLink(feature) {
const { index } = feature;
return `https://thesephist--prism-start-app.modal.run/f/${modelName}/${index}?layout=2`;
export default async function(interval: Interval) {
const response = await fetch(dictionaryUrl);
sanket_emcee avatar
valentine
@sanket_emcee
Hello!!! Feel free to mess around with this val and make it your own :). Just click on "Fork" in the top right. You can change the phrases that show up as you click no, you can change the firstImg and secondImg, maybe even add more images. And you can also change the colors and any of the text on the screen! Have fun with it and hopefully your crush says yes hehe.
HTTP
"Please don't do this to me, I'm fragile",
function App() {
const [noClicks, setNoClicks] = useState(0);
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request): Promise<Response> {
return new Response(
gab0503 avatar
emailRandomJoke
@gab0503
// Fetches a random joke.
Cron
import { email } from "https://esm.town/v/std/email?v=9";
// Fetches a random joke.
async function fetchRandomJoke() {
const response = await fetch(
"https://official-joke-api.appspot.com/random_joke",