1import { fetch } from "https://esm.town/v/std/fetch";
2
3async function fetchJSON(url: string) {
4 const response = await fetch(url);
5 if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
7}
8
9function roundTo(number: number, digits = 2) {
10 let multiplicatorString = "1";
11
20
21// View at https://wallek-currencyTransaction.val.run?target=gbp&root=eur&amount=100
22export default async function(req: Request): Promise<Response> {
23 const { rates } = await fetchJSON(`https://api.exchangerate-api.com/v4/latest/USD`);
24
4const tableName = Deno.env.get("AIRTABLE_TABLE_NAME");
5
6async function fetchAirtableData(uid: string) {
7 if (!airtableApiKey || !baseId || !tableName) {
8 throw new Error("Missing Airtable environment variables");
24}
25
26export default async function server(req: Request): Promise<Response> {
27 // Handle OPTIONS request for CORS preflight
28 if (req.method === "OPTIONS") {
2import { render } from "npm:preact-render-to-string";
3
4export default async function(req: Request) {
5 if (req.method === "POST") {
6 const name = (await req.formData()).get("name");
16 <script src="https://unpkg.com/htmx.org@1.9.9"></script>
17 <script>
18function submitHandler(event) {
19 event.preventDefault();
20 var container = event.target.parentNode;
96 });
97}
98function resetFormHandler(event) {
99 var container = event.target.parentNode;
100 var formInput = container.querySelector(".newsletter-form-input");
1import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
2
3export default async function server(req: Request): Promise<Response> {
4 const quoteResult = await sqlite.execute("SELECT * FROM smac_quotes ORDER BY RANDOM() LIMIT 1");
5
21`;
22
23export default async function server(request: Request): Promise<Response> {
24 const url = new URL(request.url);
25 const prompt = url.searchParams.get("prompt");
112 const twitterCount = document.getElementById('twitterCount');
113
114 function updateCounts() {
115 const encoder = new TextEncoder();
116 const utf8 = new Uint8Array(inputText.value.length * 3);
150 }
151
152 function adjustTextareaHeight() {
153 inputText.style.height = 'auto';
154 inputText.style.height = inputText.scrollHeight + 10 + 'px';
4import * as SPLAT from "https://cdn.jsdelivr.net/npm/gsplat@latest";
5
6function App() {
7 const canvasRef = useRef(null);
8 const progressDialogRef = useRef(null);
19 const controls = new SPLAT.OrbitControls(camera, canvas);
20
21 async function main() {
22 const url = "https://huggingface.co/datasets/dylanebert/3dgs/resolve/main/bonsai/bonsai-7k-mini.splat";
23
122}
123
124function client() {
125 createRoot(document.getElementById("root")).render(<App />);
126}
128if (typeof document !== "undefined") { client(); }
129
130export default async function server(request: Request): Promise<Response> {
131 return new Response(`
132 <!DOCTYPE html>
1Bot for Cama discord server. To initialize new slash commands, you have to run a separate bit of code. This is for modifying their functionality
58 submitBtn.parentNode.insertBefore(errorContainer, submitBtn.nextSibling);
59
60 function showError(message) {
61 errorContainer.textContent = message;
62 errorContainer.classList.remove('hidden');
63 }
64
65 function hideError() {
66 errorContainer.textContent = '';
67 errorContainer.classList.add('hidden');
71 let timerInterval;
72
73 function startTimer() {
74 startTime = Date.now();
75 timerInterval = setInterval(updateTimer, 10);
76 }
77
78 function stopTimer() {
79 clearInterval(timerInterval);
80 const elapsedTime = ((Date.now() - startTime) / 1000).toFixed(2);
83 }
84
85 function updateTimer() {
86 const elapsedTime = ((Date.now() - startTime) / 1000).toFixed(2);
87 timerDisplay.textContent = elapsedTime + 's ${model}';
88 }
89
90 async function submitForm() {
91 hideError();
92 const input = inputText.value.trim();
190 }
191 }
192 function updateResultText(data, summary) {
193 // Display JSON
194 const jsonPre = document.createElement('pre');
4// const accountId = "apn_nphbDaP";
5
6export async function getCalendars(accountId: string) {
7 const calendarAPI = await pipeDreamGoogle("calendar", accountId);
8 const calendars = await calendarAPI.calendarList.list();
11
12// list out the events on a calendar
13export async function getEvents(accountId: string, calendarId: string) {
14 const calendar = await pipeDreamGoogle("calendar", accountId);
15
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": "*",