4 * member.
5 */
6export const httpHandler = async function(req: Request): Promise<Response> {
7 if (req.method !== "POST") return new Response("Bad request: only POST allowed", { status: 400 });
8 const body = await req.json();
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export default async function(request: Request): Promise<Response> {
4 const cheerio = await import("https://esm.sh/cheerio@1.0.0-rc.12");
5 const response = await fetch("https://releases.1password.com/linux/beta/");
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export default async function(request: Request): Promise<Response> {
4 const url = new URL(request.url);
5 const query = url.searchParams.get("query") ?? "";
1var dice = {
2 sides: 6,
3 roll: function() {
4 var randomNumber = Math.floor(Math.random() * this.sides) + 1;
5 return randomNumber;
9// Prints dice roll to the page
10
11function printNumber(number) {
12 var placeholder = document.getElementById("placeholder");
13 placeholder.innerHTML = number;
16var button = document.getElementById("button");
17
18button.onclick = function() {
19 var result = dice.roll();
20 printNumber(result);
2import { easyAQI } from "https://esm.town/v/stevekrouse/easyAQI";
3
4export async function aqi(interval: Interval) {
5 const location = "brooklyn navy yard"; // <-- change to place, city, or zip code
6 const data = await easyAQI({ location });
1import { discordWebhook } from "https://esm.town/v/stevekrouse/discordWebhook";
2
3export default async function() {
4 discordWebhook({
5 url: Deno.env.get("engDiscord"),
1export async function noteToSelf(
2 { body, dmId, userId, token }: { body: object; dmId: string; userId: string; token: string },
3) {
3import { parse } from "https://esm.town/v/wittjosiah/parse_github_email";
4
5export default async function(message: Email) {
6 console.log(JSON.stringify(message, null, 2));
7 if (!message.from.endsWith("<notifications@github.com>")) {
1import { discordWebhook } from "https://esm.town/v/stevekrouse/discordWebhook";
2
3export default async function() {
4 discordWebhook({
5 url: Deno.env.get("engDiscord"),
8};
9
10async function execute(
11 code: string,
12): Promise<{ ok: true; logs: Log[] } | { ok: false; error: string }> {
18 const markStackStart = crypto.randomUUID();
19 const markStackEnd = crypto.randomUUID();
20 function cleanStack(stack: string) {
21 let lines: string[] = [];
22 for (const line of stack.split("\n")) {
33 get(target, key) {
34 const real = target[key];
35 if (typeof real === "function" && typeof key === "string") {
36 const fn = function(...args: any[]) {
37 logs.push({
38 level: key,
49 },
50 });
51 async function run() {
52 try {
53 await import(url);
A helper function to build a file's email
Simple functional CSS library for Val Town
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
import { OpenAI } from "https://esm.town/v/std/openai";
export default async function(req: Request): Promise<Response> {
if (req.method === "OPTIONS") {
return new Response(null, {
headers: {
"Access-Control-Allow-Origin": "*",