Search

Results include substring matches and semantically similar vals. Learn more
dhvanil avatar
val_8EcZC9Yvm9
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export default async function handler(req) {
try {
const result = await (async () => {
synapticrobotics avatar
RobotBackupCallGraph
@synapticrobotics
An interactive, runnable TypeScript val by synapticrobotics
HTTP
export default async function server(req: Request): Promise<Response> {
positions: function(node) {
// Custom layout function
function customLayout() {
cy.on('mouseover', 'node', function(e) {
cy.on('mouseout', 'node', function(e) {
cy.on('click', 'node', function(e) {
function highlightNodeChildrenAndParents(node) {
function unhighlightAll() {
const calledFunction = match[1].toLowerCase();
diggory avatar
aqi
@diggory
An interactive, runnable TypeScript val by diggory
Cron
import { email } from "https://esm.town/v/std/email?v=9";
import { easyAQI } from "https://esm.town/v/stevekrouse/easyAQI_cached";
export async function aqi(interval: Interval) {
const location = "10005"; // <-- change to place, city, or zip code
const data = await easyAQI({ location });
politelyinvinciblepointer avatar
getinnerfeelingscounter
@politelyinvinciblepointer
An interactive, runnable TypeScript val by politelyinvinciblepointer
Script
import { innerfeelingscounter } from "https://esm.town/v/politelyinvinciblepointer/innerfeelingscounter";
export function getinnerfeelingscounter() {
return innerfeelingscounter;
janpaul123 avatar
valle_tmp_53901278199117542092711693057927
@janpaul123
// This val fetches weather data from an open API
HTTP
// The approach involves using the fetch API provided by Deno
// to retrieve weather information for a specific location
export default async function main(req: Request): Promise<Response> {
const apiUrl = "https://api.open-meteo.com/v1/forecast?latitude=40.6782&longitude=-73.9442&hourly=temperature_2m&current_we
const response = await fetch(apiUrl);
stevekrouse avatar
hnTopStory
@stevekrouse
// Get the title of the top story on Hacker News
HTTP
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
// Get the title of the top story on Hacker News
export async function hnTopStory() {
const topStories: Number[] = await fetch(
"https://hacker-news.firebaseio.com/v0/topstories.json?print=pretty",
ayvanov avatar
test
@ayvanov
An interactive, runnable TypeScript val by ayvanov
Cron
export default async function (interval: Interval) {
hamilton avatar
duckDB
@hamilton
An interactive, runnable TypeScript val by hamilton
Script
export async function duckDB(url) {
const { Database } = await import("npm:duckdb-async");
const db = await Database.create(":memory:");
ga8ilan avatar
enchantingOliveCatfish
@ga8ilan
// Fetches a random joke.
Script
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",
dhvanil avatar
web_65yJ4LP2Qx
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function web_65yJ4LP2Qx(req) {
return new Response(`<!DOCTYPE html>
<html lang="en">
</div>
<script>
document.querySelector('.neon-button').addEventListener('click', function() {
this.style.transform = 'scale(0.95)';
setTimeout(() => {
charmaine avatar
tangibleOrangeGuanaco
@charmaine
An interactive, runnable TypeScript val by charmaine
HTTP
export default async function(req: Request): Promise<Response> {
return Response.json({ ok: true });
saolsen avatar
plausible
@saolsen
Plausible analytics Call track with the domain you set up in plausible and the request. I've been using saolsen.val-name . Note that there is no auth for the plausible events API, so if somebody forks the val it'll still work but track all their val page loads in your dashboard which is kinda weird but also kinda cool, idk. See https://www.val.town/v/saolsen/plausible_example for how to use.
Script
export async function track(domain: string, req: Request) {
await fetch("https://plausible.io/api/event", {
method: "POST",
janpaul123 avatar
valle_tmp_37837502302405213008399027398504622
@janpaul123
An interactive, runnable TypeScript val by janpaul123
HTTP
import { faker } from "npm:@faker-js/faker";
const SAMPLE_STORIES_KEY = "hn_realistic_sample_stories";
async function initializeSampleStories() {
const existingStories = await blob.getJSON(SAMPLE_STORIES_KEY);
if (!existingStories) {
dhvanil avatar
val_qWElt2jpTu
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export default async function handler(req) {
try {
const result = await (async () => {
janpaul123 avatar
valle_tmp_70427092421104433856545248978618
@janpaul123
// Initialize sample stories and store them in blob storage
HTTP
// Initialize sample stories and store them in blob storage
const SAMPLE_STORIES_KEY = "hn_sample_stories";
async function initializeSampleStories() {
const existingStories = await blob.getJSON(SAMPLE_STORIES_KEY);
if (!existingStories) {