42const url = Deno.env.get("PUSH_URL") as string;
43
44async function pushValsToGitHub() {
45 const body = "hello";
46 const signature = await sign(body, secret);
19 }
20}
21async function favicon(url: string, targetSize: number = 512) {
22 if (!inited) {
23 CanvasKit = await CanvasKitInit();
30 let faviconCandidates: { url: string; buffer: ArrayBuffer; width: number; height: number }[] = [];
31
32 async function isFavicon(u: string) {
33 try {
34 const response = await fetch(u);
82 }
83
84 async function checkSuspects(f: string) {
85 for (const suspect of usualSuspects) {
86 const result = await isFavicon(f + suspect);
88 }
89
90 async function checkTheDom(u: string) {
91 try {
92 const response = await fetch(u);
95
96 if ($("link") && $("link").length > 0) {
97 $("link").each(function() {
98 if (
99 $(this).attr("rel") && /(touch-|(\s|^))icon($|\s)/.test($(this).attr("rel")!)
119 }
120
121 async function checkAll(url: string) {
122 await isFavicon(url);
123 if (faviconCandidates.length > 0) {
788const months = ["Jan", "Feb", "Mar", "Apr", "May", "June", "July", "August", "Sept", "Oct", "Nov", "Dec"];
789
790function NavBar() {
791 return (
792 <nav className="navbar">
814}
815
816function Modal({ crop, onClose }) {
817 return (
818 <div className="modal-overlay" onClick={onClose}>
835}
836
837function CropAvailabilityTable() {
838 const [search, setSearch] = useState("");
839 const [selectedCrop, setSelectedCrop] = useState(null);
881}
882
883function About() {
884 return (
885 <section className="about-section" id="about">
894}
895
896function App() {
897 return (
898 <div className="app">
913}
914
915function client() {
916 createRoot(document.getElementById("root")).render(<App />);
917}
921}
922
923export default async function server(request) {
924 return new Response(
925 `
42 - Value: Your SERP API key.
43
44Without this key, the val will not function correctly.
45
46---
58- Key: `mentionsDiscord`
59- Value: Your Discord webhook URL.
60Notifications will be sent using this function:
61```
62 await discordWebhook({
12const isProd = true;
13
14export async function redditAlert({ lastRunAt }: Interval) {
15 if (!SERP_API_KEY || !DISCORD_API_KEY) {
16 console.error("Missing SERP_API_KEY or Discord webhook URL. Exiting.");
4import React from "https://esm.sh/react@18.2.0";
5
6function App() {
7 const draw = {
8 hidden: { pathLength: 0, opacity: 0 },
96}
97
98function client() {
99 ReactDOM.createRoot(document.getElementById("root")!).render(<App />);
100}
101if (typeof document !== "undefined") { client(); }
102
103export default async function server(request: Request): Promise<Response> {
104 return new Response(
105 `
61}
62
63function ThreeBackground() {
64 const mountRef = useRef<HTMLDivElement>(null);
65 const [threeError, setThreeError] = useState<string | null>(null);
123// Existing components and code remain the same...
124
125function App() {
126 return (
127 <ErrorBoundary>
134}
135
136function client() {
137 try {
138 createRoot(document.getElementById("root")!).render(<App />);
149if (typeof document !== "undefined") { client(); }
150
151export default async function server(request: Request): Promise<Response> {
152 return new Response(`
153 <html>
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
3import React from "https://esm.sh/react@18.2.0";
4
5function ImageGenerator() {
6 const [prompt, setPrompt] = React.useState("");
7 const [images, setImages] = React.useState<any>([]);
3import { Eval } from "npm:braintrust";
4
5export default async function handler() {
6 const result = {
7 apiKeyStatus: null,
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": "*",