10```
11
12* Export any "global" p5 functions. These are functions like `setup` and `draw` that p5 will call.
13
14* Set the val type to http and default export the result of `sketch`, passing in `import.meta.url`.
19import type * as p5 from "npm:@types/p5";
20
21export function setup() {
22 createCanvas(400, 400);
23}
24
25export function draw() {
26 if (mouseIsPressed) {
27 fill(0);
37
38## How it works
39The sketch function returns an http handler that sets up a basic page with p5.js added. It then imports your module from the browser and wires up all the exports so p5.js can see them. All the code in your val will run in the browser (except for the default `sketch` export) so you can't call any Deno functions, environment variables, or other server side apis.
40
41
1# Glide API 2.0
2
3`Effects` and utility functions for working with Glide API 2.0.
4
5## Authentication
16await Glide.importTable({
17 table: "abc123-def456-ghi789",
18 getRows: async function*() {
19 // yield Row[] to add them to the stash
20 yield [{ Name: "David" }];
30await Glide.importTable({
31 table: "abc123-def456-ghi789",
32 getRows: async function*() {
33 const octokit = new Octokit({ auth: "..." });
34 for await (
76}
77
78// Extract function to process encrypted data
79async function extract(url) {
80 try {
81 const response = await fetch(url, {
101 const _0x3cbaf6 = "episode";
102
103 function key() {
104 return $("body[class^='container-']").attr("class").split("-").pop();
105 }
106
107 function iv() {
108 return $("div[class*='container-']").attr("class").split("-").pop();
109 }
110
111 function key2() {
112 return $("div[class*='videocontent-']").attr("class").split("-").pop();
113 }
152 return _0x3b405f;
153 } catch (error) {
154 console.error("Error in extract function:", error);
155 }
156}
7import { render, React } from "https://esm.town/v/jxnblk/ReactStream";
8
9function App() {
10 const [count, setCount] = React.useState(0);
11 return (
62```tsx
63// example middleware
64async function api (req: Request, res: Response, next): Promise<Response> {
65 if (req.pathname !== "/api") return next();
66 if (req.method === "POST") {
78```tsx
79// example middleware
80async function getInitialProps (req: Request, res: Response, next) {
81 // fetch data or do async work to pass as props to the component
82 req.data = {
95import { render } from "https://esm.town/v/jxnblk/ReactStream";
96
97function App () {
98 return (
99 <html>
3import { useState } from "https://esm.sh/hono/jsx/dom";
4
5export default function Counter(props: { initialCount?: number }) {
6 const [count, setCount] = useState(props.initialCount || 0);
7 return (
1import { fetch } from "https://esm.town/v/std/fetch";
2export default async function(request: Request) {
3 const url = new URL(request.url);
4 const h = url.searchParams.get("tdestination");
9}
10
11export async function convertHTMLToJSON(html: string): Promise<ServerInfo[]> {
12 const parser = new DOMParser();
13 const doc = parser.parseFromString(html, "text/html");
23
24
25export async function getCitation(citationId: string, type = 'bibtex', opts) {
26 citationId = extractDOI(citationId);
27 console.log('citationId', citationId)
1import { blob } from "https://esm.town/v/std/blob?v=12";
2export default async function(interval: Interval) {
3 await fetch("https://tempguy-scarletsole.web.val.run/refresh");
4 const date = new Date();
1export default async function(req: Request): Promise<Response> {
2 const query = new URL(req.url).searchParams;
3 const iata = query.get("iata") || query.get("q");
A helper function to build a file's email
Simple functional CSS library for Val Town
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": "*",
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.