4import { createRoot } from "https://esm.sh/react-dom/client";
5
6function debounce(func: Function, wait: number) {
7 let timeout: number | undefined;
8 return function executedFunction(...args: any[]) {
9 const later = () => {
10 clearTimeout(timeout);
16}
17
18function App() {
19 const [prompt, setPrompt] = useState("Generate a colorful gradient shader");
20 const [code, setCode] = useState(`
79 }, [code, debouncedRenderShader, retryCount]);
80
81 async function handleSubmit(e: React.FormEvent, shaderErrorMessage?: string) {
82 if (e) e.preventDefault();
83 setLoading(true);
149}
150
151function client() {
152 createRoot(document.getElementById("root")!).render(<App />);
153}
157}
158
159function renderShader(canvas: HTMLCanvasElement, fragmentShaderSource: string, time: number) {
160 const gl = canvas.getContext("webgl");
161 if (!gl) {
171 `;
172
173 function createShader(gl: WebGLRenderingContext, type: number, source: string) {
174 const shader = gl.createShader(type);
175 if (!shader) return null;
240}
241
242function extractGLSLCode(text: string): string {
243 const glslMatch = text.match(/```glsl\n([\s\S]*?)\n```/);
244 return glslMatch
247}
248
249export default async function server(req: Request): Promise<Response> {
250 if (req.method === "POST") {
251 const client = new Cerebras();
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
4export async function dailyDadJoke() {
5 let { setup, punchline } = await fetchJSON("https://official-joke-api.appspot.com/random_joke");
6 return email({
6);
7
8export async function uptimeCheck(url: string) {
9 let ok = true;
10 let reason: string;
20export default app.fetch;
21
22function html() {
23 /*
24<!DOCTYPE html>
83}
84
85function css() {
86 /*
87body {
218}
219
220function js() {
221 /*
222const fileInput = document.getElementById('fileInput');
242let thumbnailMetadata;
243
244function updateUI() {
245 generateBtn.disabled = files.length === 0;
246 thumbWidth.disabled = keepAspectRatio.checked;
247}
248
249function resetToStep1() {
250 thumbnailOptions.style.display = 'block';
251 renderOptions.style.display = 'none';
377});
378
379function getImage(file) {
380 return new Promise((resolve) => {
381 const url = URL.createObjectURL(file);
4import { createRoot } from "https://esm.sh/react-dom/client";
5
6function debounce(func: Function, wait: number) {
7 let timeout: number | undefined;
8 return function executedFunction(...args: any[]) {
9 const later = () => {
10 clearTimeout(timeout);
16}
17
18function App() {
19 const [prompt, setPrompt] = useState("Generate a colorful gradient shader");
20 const [code, setCode] = useState(`
61 }, [code, debouncedRenderShader]);
62
63 async function handleSubmit(e: React.FormEvent) {
64 e.preventDefault();
65 setLoading(true);
121}
122
123function client() {
124 createRoot(document.getElementById("root")!).render(<App />);
125}
129}
130
131function renderShader(canvas: HTMLCanvasElement, fragmentShaderSource: string, time: number) {
132 const gl = canvas.getContext("webgl");
133 if (!gl) {
143 `;
144
145 function createShader(gl: WebGLRenderingContext, type: number, source: string) {
146 const shader = gl.createShader(type);
147 if (!shader) return null;
218}
219
220function extractGLSLCode(text: string): string {
221 const glslMatch = text.match(/```glsl\n([\s\S]*?)\n```/);
222 return glslMatch
225}
226
227export default async function server(req: Request): Promise<Response> {
228 if (req.method === "POST") {
229 const anthropic = new Anthropic();
4import { createRoot } from "https://esm.sh/react-dom/client";
5
6function debounce(func: Function, wait: number) {
7 let timeout: number | undefined;
8 return function executedFunction(...args: any[]) {
9 const later = () => {
10 clearTimeout(timeout);
16}
17
18function App() {
19 const [prompt, setPrompt] = useState("Generate a colorful gradient shader");
20 const [code, setCode] = useState(`
79 }, [code, debouncedRenderShader, retryCount]);
80
81 async function handleSubmit(e: React.FormEvent, shaderErrorMessage?: string) {
82 if (e) e.preventDefault();
83 setLoading(true);
149}
150
151function client() {
152 createRoot(document.getElementById("root")!).render(<App />);
153}
157}
158
159function renderShader(canvas: HTMLCanvasElement, fragmentShaderSource: string, time: number) {
160 const gl = canvas.getContext("webgl");
161 if (!gl) {
171 `;
172
173 function createShader(gl: WebGLRenderingContext, type: number, source: string) {
174 const shader = gl.createShader(type);
175 if (!shader) return null;
240}
241
242function extractGLSLCode(text: string): string {
243 const glslMatch = text.match(/```glsl\n([\s\S]*?)\n```/);
244 return glslMatch
247}
248
249export default async function server(req: Request): Promise<Response> {
250 if (req.method === "POST") {
251 const client = new Cerebras();
4import { createRoot } from "https://esm.sh/react-dom/client";
5
6function debounce(func: Function, wait: number) {
7 let timeout: number | undefined;
8 return function executedFunction(...args: any[]) {
9 const later = () => {
10 clearTimeout(timeout);
16}
17
18function App() {
19 const [prompt, setPrompt] = useState("Generate a colorful gradient shader");
20 const [code, setCode] = useState(`
79 }, [code, debouncedRenderShader, retryCount]);
80
81 async function handleSubmit(e: React.FormEvent, shaderErrorMessage?: string) {
82 if (e) e.preventDefault();
83 setLoading(true);
149}
150
151function client() {
152 createRoot(document.getElementById("root")!).render(<App />);
153}
157}
158
159function renderShader(canvas: HTMLCanvasElement, fragmentShaderSource: string, time: number) {
160 const gl = canvas.getContext("webgl");
161 if (!gl) {
171 `;
172
173 function createShader(gl: WebGLRenderingContext, type: number, source: string) {
174 const shader = gl.createShader(type);
175 if (!shader) return null;
240}
241
242function extractGLSLCode(text: string): string {
243 const glslMatch = text.match(/```glsl\n([\s\S]*?)\n```/);
244 return glslMatch
247}
248
249export default async function server(req: Request): Promise<Response> {
250 if (req.method === "POST") {
251 const client = new Cerebras();
3import { fetch } from "https://esm.town/v/std/fetch";
4
5export async function bsky_rss_poll() {
6 const { parseFeed } = await import("https://deno.land/x/rss/mod.ts");
7 const res = await fetch("https://v8.dev/blog.atom")
4It's split into three parts:
51. [`bsky_rss_poll`](https://val.town/@jordan.bsky_rss_poll)
6 - This function runs every hour and polls the provided RSS feed, turns it into XML and runs the check. If there *is* a new post, it tell `rss_to_bsky`to post a link (and the title) to Bluesky
72. [`latest_rss`](https://val.town/@jordan.latest_rss)
8 - This is a stored object that keeps the latest object for the poll to test against
93. [`rss_to_bsky`](https://val.town/@jordan.rss_to_bsky)
10 - This function turns the text post into a rich text post and posts it to Bluesky
11
12Migrated from folder: Archive/bsky_rss_poll
1export function extractValInfo(url: string | URL) {
2 const { pathname, search } = new URL(url);
3 const [author, filename] = pathname.split("/").slice(-2);