Search
![yawnxyz avatar](https://images.clerk.dev/oauth_github/img_2NnaHhpxNuH1xWRIRjQNoo16TVc.jpeg)
blobbyFace
@yawnxyz
(todo) This lists all your blobs. You can create new blobs, edit them, or even preview (and upload) file blobs from both URL and computer!
HTTP
// console.log('blobbyList:', blobbyList.length);
async function streamToBuffer(stream) {
const chunks = [];
return new Uint8Array(chunks.reduce((acc, chunk) => acc.concat(Array.from(chunk)), []));
async function detectFileType(buffer) {
const type = await fileTypeFromBuffer(buffer);
return type ? type.mime : 'text/plain';
export async function get(key, c) {
let result = await blobby.get(key);
newKeyName: '',
init: async function() {
console.log('blobby:', this.blobby);
![yawnxyz avatar](https://images.clerk.dev/oauth_github/img_2NnaHhpxNuH1xWRIRjQNoo16TVc.jpeg)
honoAlpineExample
@yawnxyz
// Endpoint to catch and log the submitted name
HTTP
output: null,
init() {
// if you don't use an arrow function (this) will refer to document, not alpine
document.addEventListener('htmx:afterSwap', (event) => this.updateOutput(event));
updateOutput(event) {
![hafifuyku avatar](https://images.clerk.dev/oauth_github/img_2RbRKSRseJV3qr0ZxdMeYsdHLdy.jpeg)
myApi
@hafifuyku
An interactive, runnable TypeScript val by hafifuyku
Script
export function myApi(name) {
return "hi " + name;
![stevekrouse avatar](https://images.clerk.dev/uploaded/img_2PqHa2Gsy93xQrjh2w78Xu0cChW.jpeg)
getWeather
@stevekrouse
Get Weather Simple function to get weather data from the free wttr.in service. import { getWeather } from "https://esm.town/v/stevekrouse/getWeather";
let weather = await getWeather("Brooklyn, NY");
console.log(weather.current_condition[0].FeelsLikeF)
Script
## Get Weather
Simple function to get weather data from the free [wttr.in](https://wttr.in/:help) service.
```ts
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
export async function getWeather(location: string): Promise<WeatherResponse> {
return fetchJSON(`https://wttr.in/${location}?format=j1`);
export interface WeatherResponse {
![pomdtr avatar](https://images.clerk.dev/oauth_github/img_2RCoAITJZH1QencEgtVjh4Qirj4.jpeg)
deeplink
@pomdtr
An interactive, runnable TypeScript val by pomdtr
HTTP
export default function(req: Request) {
const url = new URL(req.url);
if (!url.searchParams.has("url")) {
![stungeye avatar](https://images.clerk.dev/oauth_github/img_2RIPREALjKf7j64xU3fWjMu1RTw.jpeg)
myApi
@stungeye
An interactive, runnable TypeScript val by stungeye
Script
export function myApi(name) {
return "hi " + name;
![stevekrouse avatar](https://images.clerk.dev/uploaded/img_2PqHa2Gsy93xQrjh2w78Xu0cChW.jpeg)
dailyStandupBot
@stevekrouse
Daily Standup Bot Every weekday at 9am EDT send a message to our team's #engineering Discord channel to start a thread to remind us to do our standup. Slack version: @mikker/dailySlackRoundup Note : We started doing in-person standups at Val Town, so this val was unscheduled.
To get it working for you, you'll need to: Fork it Change its type from Script to Cron and set a schedule like 0 13 * * 1-5
Cron
import { discordWebhook } from "https://esm.town/v/stevekrouse/discordWebhook";
export default async function() {
discordWebhook({
url: Deno.env.get("engDiscord"),
![codingjlu avatar](https://images.clerk.dev/oauth_github/img_2RkpMLHflzZu5BWtV9YQE1od4gZ.png)
myApi
@codingjlu
An interactive, runnable TypeScript val by codingjlu
Script
export function myApi(name) {
return "hi " + name;
![jbeimler avatar](https://images.clerk.dev/oauth_github/img_2Rt0L6d8Cjza1p9A01Fg0DLn1pX.jpeg)
myApi
@jbeimler
An interactive, runnable TypeScript val by jbeimler
Script
export function myApi(name) {
return "hi " + name;
emojiGuessr
@jdan
Calorie Count via Photo Uploads your photo to ChatGPT's new vision model to automatically categorize the food and estimate the calories.
HTTP
import { fileToDataURL } from "https://esm.town/v/stevekrouse/fileToDataURL";
import { modifyImage } from "https://esm.town/v/stevekrouse/modifyImage";
import { chat } from "https://esm.town/v/stevekrouse/openai";
import { Hono } from "npm:hono@3";
function esmTown(url) {
return fetch(url, {
headers: {
![zdf188 avatar](https://images.clerk.dev/oauth_github/img_2QwpI2wWF81NuPuohnUIECMDPpO.jpeg)
myApi
@zdf188
An interactive, runnable TypeScript val by zdf188
Script
export function myApi(name) {
return "hi " + name;
![stevekrouse avatar](https://images.clerk.dev/uploaded/img_2PqHa2Gsy93xQrjh2w78Xu0cChW.jpeg)
usageAlert
@stevekrouse
HTTP Val Usage Alert As of Oct 29, 2024, HTTP vals can comfortably run 2k times per minute. If you want to get alerted if you val is getting close to those limits, you can wrap your HTTP
handler in this middleware: import { usageAlert } from "https://esm.town/v/stevekrouse/usageAlert"
async function sampleHandler(req: Request): Promise<Response> {
return new Response("Hello, World!");
}
export default usageAlert(sampleHandler); It keeps a sliding window count of requests in memory (which is perfect for this sittuation)
and will send you an email using @std/email if you go over 1k req / min.
Script
import { usageAlert } from "https://esm.town/v/stevekrouse/usageAlert"
async function sampleHandler(req: Request): Promise<Response> {
return new Response("Hello, World!");
import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo?v=29";
import { email } from "https://esm.town/v/std/email?v=13";
export function usageAlert(handler: (req: Request) => Promise<Response>) {
const requestCounts: number[] = [];
const LIMIT = 1000;
![rlesser avatar](https://images.clerk.dev/uploaded/img_2QGEZ0ui5UEoQpzrCTbFslYSosv.jpeg)
pushover
@rlesser
// Send a pushover message.
Script
// Send a pushover message.
// token, user, and other opts are as specified at https://pushover.net/api
export async function pushover({ token, user, message, title, url, ...opts }) {
return await fetch("https://api.pushover.net/1/messages.json", {
method: "POST",