1import * as THREE from 'https://cdn.skypack.dev/three@0.128.0';
2
3export function create3DEmoji(emoji, width, height) {
4 // canvas element
5 const canvas = document.createElement('canvas');
57
58 // animation loop
59 function animate() {
60 requestAnimationFrame(animate);
61
1import { imageToAscii } from "https://esm.town/v/maxm/imageToAscii";
2
3export default async function(req: Request): Promise<Response> {
4 const { string, stringColor } = await imageToAscii(
5 "https://webcams.nyctmc.org/api/cameras/9fa5b0dd-e955-449e-97e1-9c53ad9c23a8/image",
3import { newRSSItems } from "https://esm.town/v/stevekrouse/newRSSItems";
4
5export async function pollRSSFeeds({ lastRunAt }: Interval) {
6 return Promise.all(
7 Object.entries(rssFeeds).map(async ([name, url]) => {
1import { html } from "https://esm.town/v/stevekrouse/html";
2
3export default async function (req: Request): Promise<Response> {
4 return html(`
5 <button id="find-me">Show my location</button><br />
7 <a id="map-link" target="_blank"></a>
8 <script>
9 function geoFindMe() {
10 const status = document.querySelector("#status");
11 const mapLink = document.querySelector("#map-link");
14 mapLink.textContent = "";
15
16 function success(position) {
17 const latitude = position.coords.latitude;
18 const longitude = position.coords.longitude;
23 }
24
25 function error() {
26 status.textContent = "Unable to retrieve your location";
27 }
8```
9
10call the function after the DOM has loaded
11```JavaScript
12import { create3DEmoji } from 'https://esm.town/v/iamseeley/threedEmoji';
26// Converted from: https://github.com/victorqribeiro/imgToAscii/blob/ca7e181b9bb9770798ed3a0d3dfeb344c60953f2/src/imgToAscii.js
27import { createCanvas, loadImage } from "https://deno.land/x/canvas@v1.4.1/mod.ts";
28export async function imageToAscii(src: string, maxWidth?: number) {
29 let string = "";
30 let stringColor = "";
2import { createClient } from "npm:@libsql/client";
3
4export function createTursoProxy(databaseUrl: string, authToken: string) {
5 const client = createClient({
6 url: `${databaseUrl}?authToken=${Deno.env.get("TURSO_AUTH_TOKEN")}`,
37// });
38
39function parseResultSet<T>(row: ResultSet): T[] {
40 return row.rows.map((r) => Object.fromEntries(r.map((c, i) => [row.columns[i], c]))) as T[];
41}
51};
52
53function diffCircles(array1: Circle[], array2: Circle[]): Circle[] {
54 const changes: Circle[] = [];
55
74
75 const drag = (() => {
76 function dragstarted() {
77 d3.select(this).attr("stroke", "black");
78 }
79
80 function dragged(event, d) {
81 d3.select(this).raise().attr("cx", d.x = event.x).attr("cy", d.y = event.y);
82 }
83
84 function dragended() {
85 const x = d3.select(this).attr("cx");
86 const y = d3.select(this).attr("cy");
105 .call(drag)
106 .on("click", clicked);
107 function clicked(event, d) {
108 if (event.defaultPrevented) return; // dragged
109
2import { renderToString } from "npm:react-dom/server";
3
4export default async function(req: Request) {
5 return new Response(
6 renderToString(
6let linkClass = "text-sky-600 hover:text-sky-500";
7
8export default function FAQ(c) {
9 return c.html(
10 <Layout activeTab={new URL(c.req.url).pathname}>
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": "*",