4const cacheKey = "donation_data_cache";
56// Utility functions for formatting
7function formatDate(dateString: string): string {
8return new Date(dateString).toLocaleString("en-US", {
9year: "numeric",
16}
1718function formatCurrency(amount: number, currencyCode: string): string {
19return new Intl.NumberFormat("en-US", {
20style: "currency",
23}
2425function formatGoalAmount(amount: number): string {
26if (amount >= 1000000) {
27return `${Math.round(amount / 1000000)}M`;
33}
3435function calculateBarWidth(totalRaised: number, goalAmount: number): string {
36const percentage = (totalRaised / goalAmount) * 100;
37return `${Math.min(Math.round(percentage), 100)}%`;
38}
3940async function fetchAndCacheData() {
41try {
42console.log("Fetching URL:", url);
86}
8788async function getFullData() {
89const data = await fetchAndCacheData();
90const donationGoal = data.checkoutLink.checkout_link_data.donation_goal;
106}
107108async function getDonationProgress() {
109const data = await fetchAndCacheData();
110const donationGoal = data.checkoutLink.checkout_link_data.donation_goal;
120}
121122async function getCheckoutDetails() {
123const data = await fetchAndCacheData();
124return Response.json({
129}
130131async function getCampaignInfo() {
132const data = await fetchAndCacheData();
133const linkData = data.checkoutLink.checkout_link_data;
140}
141142async function getScrapedData() {
143const data = await fetchAndCacheData();
144const donationGoal = data.checkoutLink.checkout_link_data.donation_goal;
156}
157158function getDemoData() {
159const goalAmount = 1000000; // $100,00
160const totalRaised = Math.floor(Math.random() * goalAmount);
169}
170171function get2023Data() {
172const goalAmount = 1000000;
173const totalRaised = 1654700;
182}
183184async function getHtmlView() {
185const scrapedData = await getScrapedData();
186const demoData = await getDemoData();
253}
254255async function getFundraiserHtml() {
256const scrapedData = await getScrapedData();
257const demoData = await getDemoData();
374});
375}
376async function finalGoal() {
377const goalAmount = 1000000;
378const totalRaised = 729438;
398};
399400export default async function(req: Request): Promise<Response> {
401const { pathname } = new URL(req.url);
402const handler = router[pathname];
blob_adminmain.tsx8 matches
13}
1415function Tooltip({ children, content }: TooltipProps) {
16const [isVisible, setIsVisible] = useState(false);
17const tooltipRef = useRef<HTMLDivElement>(null);
52}
5354function formatBytes(bytes: number, decimals = 2) {
55if (bytes === 0) return "0 Bytes";
56const k = 1024;
61}
6263function copyToClipboard(text: string) {
64navigator.clipboard.writeText(text).then(() => {
65console.log("Text copied to clipboard");
69}
7071function ActionMenu({ blob, onDownload, onRename, onDelete, onMoveToPublic, onMoveOutOfPublic }) {
72const [isOpen, setIsOpen] = useState(false);
73const menuRef = useRef(null);
7677useEffect(() => {
78function handleClickOutside(event) {
79if (menuRef.current && !menuRef.current.contains(event.target)) {
80event.stopPropagation();
158}
159160function BlobItem({ blob, onSelect, isSelected, onDownload, onRename, onDelete, onMoveToPublic, onMoveOutOfPublic }) {
161const [isLoading, setIsLoading] = useState(false);
162const decodedKey = decodeURIComponent(blob.key);
219}
220221function App({ initialEmail, initialProfile }) {
222const encodeKey = (key: string) => encodeURIComponent(key);
223const decodeKey = (key: string) => decodeURIComponent(key);
645}
646647function client() {
648const initialEmail = document.getElementById("root").getAttribute("data-email");
649const initialProfile = JSON.parse(document.getElementById("root").getAttribute("data-profile"));
libgenopdsmain.tsx5 matches
5const LIBGEN_LI_DOWNLOAD_URL = "https://libgen.li";
67async function search(query: string) {
8const url = new URL(
9"https://annas-archive.org/search?index=&page=1&display=table&content=book_nonfiction&content=book_fiction&ext=epub&src=lgrs&sort=",
95}
9697async function fetchMetadataLibgenRs(
98url: string | undefined,
99identifier: string | undefined = undefined,
150}
151152async function fetchMetadataLibgenLi(
153url: string | undefined,
154identifier: string | undefined = undefined,
189}
190191function generatePublication(libgenMetadata: any) {
192return JSON.parse(JSON.stringify(
193{
222}
223224export default async function server(request: Request): Promise<Response> {
225const url = new URL(request.url);
226const pathname = url.pathname;
disposablemain.tsx1 match
1export function disposable<T extends object>(
2value: T,
3onDispose: (value: T) => void,
10};
1112export async function acquireLock(opts?: LockOptions): Promise<LockHandle> {
13let id = opts?.id ?? parentReference().userHandle + "-" + parentReference().valName;
14id = id.replace(/[^\w]+/g, "_");
15const ttl = opts?.ttl ?? 3;
1617async function handleError(error: string) {
18if (typeof opts?.retries === "number" && (opts.retry ?? 0) >= opts.retries) {
19throw new LockError(`LockError: failed with message "${error || "unknown error"}"`);
51resolve,
52} = Promise.withResolvers();
53async function release(): Promise<LockResponse | undefined> {
54releasedRequest ??= makeRequest(id, "release", {
55lease,
82};
8384export async function makeRequest(id: string, method: "release" | "acquire", params): Promise<LockResponse> {
85return fetchJSON(
86`https://dlock.univalent.net/lock/${id}/${method}?${searchParams(params)}`,
88}
8990export function createMemoryLock() {
91let released = Promise.resolve(undefined);
92
zyloxAIChatAppmain.tsx3 matches
4import OpenAI from "https://esm.sh/openai@4.28.4";
56function App() {
7const [messages, setMessages] = useState([]);
8const [inputMessage, setInputMessage] = useState("");
177}
178179function client() {
180createRoot(document.getElementById("root")).render(<App />);
181}
182if (typeof document !== "undefined") { client(); }
183184export default async function server(request: Request): Promise<Response> {
185if (request.method === "POST" && new URL(request.url).pathname === "/chat") {
186const { OpenAI } = await import("https://esm.town/v/std/openai");
compassionateBlackCatfishmain.tsx7 matches
1import OpenAI from "https://esm.sh/openai@4.28.4";
23export default async function(req: Request): Promise<Response> {
4const LEPTON_API_TOKEN = Deno.env.get('LEPTON_API_TOKEN') || '';
583const audioInput = document.getElementById('audio-input');
8485function createMatrixBackground() {
86const canvas = document.createElement('canvas');
87const ctx = canvas.getContext('2d');
106}
107108function draw() {
109ctx.fillStyle = 'rgba(0, 0, 0, 0.05)';
110ctx.fillRect(0, 0, canvas.width, canvas.height);
129createMatrixBackground();
130131function addMessage(role, content, isTyping = false, contentType = 'text') {
132const msgParent = document.createElement("div");
133msgParent.className = "mb-4 " + (role === 'user' ? 'text-right' : 'text-left');
158if (file) {
159const reader = new FileReader();
160reader.onload = async function(e) {
161const base64Audio = e.target.result.split(',')[1];
162addMessage('user', file.name, false, 'audio');
218});
219220document.getElementById("input").addEventListener("submit", async function(event) {
221event.preventDefault();
222const userMessage = event.target.message.value;
302303// Add a separate API route handler for chat
304export async function handler(req: Request) {
305if (req.method !== 'POST') {
306return new Response('Method Not Allowed', { status: 405 });
stellarCrimsonPandamain.tsx11 matches
24);
2526function Hero({
27prompt,
28setPrompt,
4546<p className="text-[#bababa] text-center max-w-[25ch] mx-auto my-4 font-dm-sans">
47Turn your ideas into fully functional apps in{" "}
48<span className="relative w-fit text-fuchsia-400 z-10 italic font-semibold rounded-full">
49less than a second
116}
117118function App() {
119const previewRef = React.useRef<HTMLDivElement>(null);
120const [prompt, setPrompt] = useState("");
170});
171172function handleStarterPromptClick(promptItem: typeof prompts[number]) {
173setLoading(true);
174setTimeout(() => handleSubmit(promptItem.prompt), 0);
175}
176177async function handleSubmit(e: React.FormEvent | string) {
178if (typeof e !== "string") {
179e.preventDefault();
226}
227228function handleVersionChange(direction: "back" | "forward") {
229const { currentVersionIndex, versions } = versionHistory;
230if (direction === "back" && currentVersionIndex > 0) {
974);
975976function client() {
977const path = window.location.pathname;
978const root = createRoot(document.getElementById("root")!);
1010}
10111012function extractCodeFromFence(text: string): string {
1013const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
1014return htmlMatch ? htmlMatch[1].trim() : text;
1015}
10161017async function generateCode(prompt: string, currentCode: string) {
1018const starterPrompt = STARTER_PROMPTS.find(p => p.prompt === prompt);
1019if (starterPrompt) {
1060}
10611062export default async function cerebras_coder(req: Request): Promise<Response> {
1063// Dynamic import for SQLite to avoid client-side import
1064const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
1163<meta property="og:site_name" content="Cerebras Coder">
1164<meta property="og:url" content="https://cerebrascoder.com"/>
1165<meta property="og:description" content="Turn your ideas into fully functional apps in less than a second – powered by Llama3.3-70b on Cerebras's super-fast wafer chips. Code is 100% open-source, hosted on Val Town."">
1166<meta property="og:type" content="website">
1167<meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">
cerebras_codermain.tsx11 matches
24);
2526function Hero({
27prompt,
28setPrompt,
4546<p className="text-[#bababa] text-center max-w-[25ch] mx-auto my-4 font-dm-sans">
47Turn your ideas into fully functional apps in{" "}
48<span className="relative w-fit text-fuchsia-400 z-10 italic font-semibold rounded-full">
49less than a second
116}
117118function App() {
119const previewRef = React.useRef<HTMLDivElement>(null);
120const [prompt, setPrompt] = useState("");
170});
171172function handleStarterPromptClick(promptItem: typeof prompts[number]) {
173setLoading(true);
174setTimeout(() => handleSubmit(promptItem.prompt), 0);
175}
176177async function handleSubmit(e: React.FormEvent | string) {
178if (typeof e !== "string") {
179e.preventDefault();
226}
227228function handleVersionChange(direction: "back" | "forward") {
229const { currentVersionIndex, versions } = versionHistory;
230if (direction === "back" && currentVersionIndex > 0) {
974);
975976function client() {
977const path = window.location.pathname;
978const root = createRoot(document.getElementById("root")!);
1010}
10111012function extractCodeFromFence(text: string): string {
1013const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
1014return htmlMatch ? htmlMatch[1].trim() : text;
1015}
10161017async function generateCode(prompt: string, currentCode: string) {
1018const starterPrompt = STARTER_PROMPTS.find(p => p.prompt === prompt);
1019if (starterPrompt) {
1060}
10611062export default async function cerebras_coder(req: Request): Promise<Response> {
1063// Dynamic import for SQLite to avoid client-side import
1064const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
1163<meta property="og:site_name" content="Cerebras Coder">
1164<meta property="og:url" content="https://cerebrascoder.com"/>
1165<meta property="og:description" content="Turn your ideas into fully functional apps in less than a second – powered by Llama3.3-70b on Cerebras's super-fast wafer chips. Code is 100% open-source, hosted on Val Town."">
1166<meta property="og:type" content="website">
1167<meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">
calculateRequiredQuantityAppmain.tsx4 matches
3import React, { useRef, useState } from "https://esm.sh/react@18.2.0";
45function PriceQuantityCalculator() {
6const [calculation, setCalculation] = useState({
7item: "",
204}
205206function App() {
207return <PriceQuantityCalculator />;
208}
209210function client() {
211createRoot(document.getElementById("root")).render(<App />);
212}
213if (typeof document !== "undefined") { client(); }
214215export default async function server(request: Request): Promise<Response> {
216return new Response(
217`