5import { zip } from "npm:lodash-es";
6
7function absoluteURL(url) {
8 if (url.startsWith("http://") || url.startsWith("https://"))
9 return url;
24let linkClass = "text-sky-600 hover:text-sky-500";
25
26function httpsIfy(url: string) {
27 if (!url.startsWith("http://") && !url.startsWith("https://")) {
28 return `https://${url}`;
31}
32
33function renderCell(header, row) {
34 let data = row[header];
35 if (header === "Name") {
49}
50
51export default async function Browse(c) {
52 const url = new URL(c.req.url);
53 const search = {
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable
35- [x] add export to CSV, and JSON (CSV and JSON helper functions written in [this val](https://www.val.town/v/nbbaier/sqliteExportHelpers). Thanks to @pomdtr for merging the initial version!)
36- [x] add listener for cmd+enter to submit query
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 readwiseHighlights(token: string, ids?: number[]) {
2 let fullData = [];
3 let nextPageCursor = null;
24}
25
26export async function readwiseReaderDocumentList(
27 token: string,
28 updatedAfter: string | undefined,
2import { readwiseReaderDocumentList } from "https://esm.town/v/zerovox/readwiseReaderDocumentList";
3
4export async function readwiseReaderReadItemsRss() {
5 // Get all of a user's archived documents
6 const archivedData = await readwiseReaderDocumentList(Deno.env.get("readwiseReaderApiToken"), undefined, "archive");
25}
26
27function escapeXml(unsafe) {
28 return unsafe.replace(/[<>&'"]/g, function(c) {
29 switch (c) {
30 case "<":
13
14const clientCode = () => {
15 document.getElementById("input").addEventListener("submit", async function(event) {
16 event.preventDefault();
17
45 + `&assistantId=${input.getAttribute("data-assistant-id")}`,
46 );
47 eventSource.onmessage = function(event) {
48 console.log(event);
49 responseDiv.innerText += JSON.parse(event.data);
50 };
51
52 eventSource.onerror = function() {
53 eventSource.close();
54 };
3const lerp = (a, b, t) => (1 - t) * a + t * b;
4
5function transform(a, b, M, roundToInt = false) {
6 const round = (v) => (roundToInt ? v | 0 : v);
7 return [
1import Pipeline from "https://esm.town/v/iamseeley/pipeline";
2
3export default async function handler(req) {
4 if (req.method === "GET") {
5 return new Response(`
16
17 <script>
18 document.getElementById('translationForm').addEventListener('submit', async function(event) {
19 event.preventDefault();
20 const formData = new FormData(this);
1import Pipeline from "https://esm.town/v/iamseeley/pipeline";
2
3export default async function handler(req) {
4 if (req.method === "GET") {
5 return new Response(`
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": "*",