githubParsermain.tsx4 matches
16<meta charset="UTF-8">
17<meta name="viewport" content="width=device-width, initial-scale=1.0">
18<link rel="icon" type="image/png" href="https://labspace.ai/ls2-circle.png" />
19<title>GitHub Repository Parser</title>
20<meta property="og:title" content="GitHub Repository Parser" />
21<meta property="og:description" content="Parse and analyze GitHub repositories with ease." />
22<meta property="og:image" content="https://yawnxyz-og.web.val.run/img2?link=https://gh.labspace.ai/&title=GitHub+Parser&subtitle=Parse+and+analyze+GitHub+repos&attachment=https://f2.phage.directory/blogalog/gh-parser.jpg" />
23<meta property="og:url" content="https://gh.labspace.ai" />
24<meta property="og:type" content="website" />
25<meta name="twitter:card" content="summary_large_image" />
26<meta name="twitter:title" content="GitHub Repository Parser" />
27<meta name="twitter:description" content="Parse and analyze GitHub repositories with ease." />
28<meta name="twitter:image" content="https://yawnxyz-og.web.val.run/img2?link=https://gh.labspace.ai/&title=GitHub+Parser&subtitle=Parse+and+analyze+GitHub+repos&attachment=https://f2.phage.directory/blogalog/gh-parser.jpg" />
29<script src="https://cdn.tailwindcss.com"></script>
30<script src="https://unpkg.com/dexie@3.2.2/dist/dexie.js"></script>
cerebras_codermain.tsx1 match
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">
1168
1169
imageUploadPerMinuteWebsitemain.tsx40 matches
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
45// Main React component for the image upload application
6function App() {
7// State variables to manage images, error messages, upload restrictions, and comments
8const [images, setImages] = useState([]); // Stores uploaded images
9const [error, setError] = useState(null); // Stores error messages
10const [canUpload, setCanUpload] = useState(true); // Controls upload ability
11const [showComments, setShowComments] = useState(false); // Controls comment visibility
12const [comments, setComments] = useState([]); // Stores comments for images
13const [newComment, setNewComment] = useState(''); // Stores new comment input
14const [username, setUsername] = useState(''); // Stores username
19const [uploadProgress, setUploadProgress] = useState(0); // Upload progress
20const [isUploading, setIsUploading] = useState(false); // Upload in progress flag
21const [currentPage, setCurrentPage] = useState(1); // Current page of images
22const [totalPages, setTotalPages] = useState(0); // Total pages of images
2324// Load username from localStorage on component mount
25useEffect(() => {
26const storedUsername = localStorage.getItem('imageAppUsername');
27if (storedUsername) {
28setUsername(storedUsername);
31}, []);
3233// Fetch images and comments when the component first loads or page changes
34useEffect(() => {
35fetchImages();
36fetchComments();
37}, [currentPage]);
3839// Function to retrieve images from the server with pagination
40const fetchImages = async () => {
41try {
42const response = await fetch(`/images?page=${currentPage}`);
43const data = await response.json();
44setImages(data.images);
45setTotalPages(data.totalPages);
46} catch (err) {
47setError("Could not fetch images");
48console.error("Image fetch error:", err);
49}
50};
74// Validate file types and sizes
75const validFiles = files.filter(file =>
76file.type.startsWith('image/') &&
77file.size <= 5 * 1024 * 1024 // 5MB max file size
78);
108const uploadPromises = batch.map(async (file) => {
109const formData = new FormData();
110formData.append('image', file);
111formData.append('username', username);
112127}
128129// Refresh images after upload
130await fetchImages();
131
132// Reset upload states
160return (
161<div style={{ maxWidth: '800px', margin: 'auto', padding: '20px' }}>
162<h1>🖼️ Bulk Image Uploader 📸</h1>
163
164{/* Username setup (existing code) */}
177type="file"
178multiple
179accept="image/*"
180onChange={handleFileSelect}
181disabled={!isUsernameSet || isUploading}
269async function handleUpload(request, sqlite, KEY, TABLE_VERSION) {
270const formData = await request.formData();
271const image = formData.get('image') as File;
272const username = formData.get('username') as string;
273274if (!image || !(image instanceof File)) {
275return new Response(JSON.stringify({ message: "No image uploaded" }), {
276status: 400,
277headers: { 'Content-Type': 'application/json' }
279}
280281const arrayBuffer = await image.arrayBuffer();
282const base64Image = btoa(String.fromCharCode.apply(null, new Uint8Array(arrayBuffer)));
283const dataUrl = `data:${image.type};base64,${base64Image}`;
284285await sqlite.execute(`
286INSERT INTO ${KEY}_images_${TABLE_VERSION} (image_url, username) VALUES (?, ?)
287`, [dataUrl, username]);
288292}
293294async function handleGetImages(sqlite, KEY, TABLE_VERSION, page = 1, pageSize = 100) {
295const offset = (page - 1) * pageSize;
296297// Get total number of images
298const totalCountResult = await sqlite.execute(`
299SELECT COUNT(*) as total
300FROM ${KEY}_images_${TABLE_VERSION}
301`);
302const totalImages = totalCountResult.rows[0].total;
303const totalPages = Math.ceil(totalImages / pageSize);
304305// Get paginated images
306const images = await sqlite.execute(`
307SELECT id, image_url, username
308FROM ${KEY}_images_${TABLE_VERSION}
309ORDER BY uploaded_at DESC
310LIMIT ? OFFSET ?
312313return new Response(JSON.stringify({
314images: images.rows,
315totalPages: totalPages,
316currentPage: page
321322// Modify the server switch statement to pass page parameter
323case '/images':
324if (request.method !== 'GET') break;
325const url = new URL(request.url);
326const page = parseInt(url.searchParams.get('page') || '1', 10);
327return await handleGetImages(sqlite, KEY, TABLE_VERSION, page);
1415<img
16src="https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/d2a422fe-8dc3-4f04-aaa3-3c35a2e99100/public"
17width="500px"
18/>
50where they can pick which way to login: email, Google, Github, etc.
5152
5354[Live Demo](https://www.val.town/v/stevekrouse/lastlogin_demo)
sqlite_adminREADME.md1 match
3This is a lightweight SQLite Admin interface to view and debug your SQLite data.
45
67It's currently super limited (no pagination, editing data, data-type specific viewers), and is just a couple dozens lines of code over a couple different vals. Forks encouraged! Just comment on the val if you add any features that you want to share.
33Category?: string;
34Tags?: string[];
35"Card Image"?: AirtableAttachment[];
36"Intro Image"?: AirtableAttachment[];
37"Body Image 1"?: AirtableAttachment[];
38"Body Image 2"?: AirtableAttachment[];
39"Body Image 3"?: AirtableAttachment[];
40"Quote or Emphasized Text 1"?: string;
41"Quote or Emphasized Text 2"?: string;
68category: string;
69tags: string[];
70cardImage: string;
71introImage: string;
72bodyImage1: string;
73bodyImage2: string;
74bodyImage3: string;
75quoteText1: string;
76quoteText2: string;
223category: rec.fields["Category"] || "",
224tags: [...(rec.fields["Tags"] || []), ...(aiEnhancements?.aiTags || [])],
225cardImage: getAttachmentUrl(rec.fields["Card Image"]),
226introImage: getAttachmentUrl(rec.fields["Intro Image"]),
227bodyImage1: getAttachmentUrl(rec.fields["Body Image 1"]),
228bodyImage2: getAttachmentUrl(rec.fields["Body Image 2"]),
229bodyImage3: getAttachmentUrl(rec.fields["Body Image 3"]),
230quoteText1: rec.fields["Quote or Emphasized Text 1"] || "",
231quoteText2: rec.fields["Quote or Emphasized Text 2"] || "",
codeOnValTownREADME.md1 match
1# Code on Val Town
23
45Adds a "Code on Val Town" ribbon to your page. This lets your website visitors navigate to the code behind it.
contentTemplateAppmain.tsx12 matches
24Category?: string;
25Tags?: string | string[];
26"Card Image"?: AirtableAttachment[];
27"Intro Image"?: AirtableAttachment[];
28"Body Image 1"?: AirtableAttachment[];
29"Body Image 2"?: AirtableAttachment[];
30"Body Image 3"?: AirtableAttachment[];
31"Quote or Emphasized Text 1"?: string;
32"Quote or Emphasized Text 2"?: string;
164<p className="mb-2">{item.fields.ShortCardText}</p>
165<p className="text-sm text-gray-600 mb-4">Read time: {item.fields.ReadTime}</p>
166{item.fields["Card Image"] && item.fields["Card Image"][0] && (
167<img
168src={item.fields["Card Image"][0].url}
169alt={item.fields.Title}
170className="w-full h-48 object-cover rounded-md mb-4"
467title={item.fields.Title}
468description={item.fields.ShortCardText}
469image={item.fields["Card Image"] && item.fields["Card Image"][0] ? item.fields["Card Image"][0].url : null}
470/>
471)),
473}
474475function ContentItem({ title, description, image }) {
476return {
477width: 300,
482boxShadow: "0 4px 6px rgba(0,0,0,0.1)",
483children: [
484image && {
485width: "100%",
486height: 200,
487background: `url(${image})`,
488backgroundSize: "cover",
489backgroundPosition: "center",
490},
491{
492y: image ? 200 : 0,
493padding: 20,
494children: [
cerebras_codermain.tsx1 match
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">
1168
1169
refinedHarlequinPumamain.tsx3 matches
13if (selectedFile) {
14// Validate file type and size
15const allowedTypes = ['image/', 'video/'];
16const maxFileSize = 50 * 1024 * 1024; // 50MB
1789<input
90type="file"
91accept="image/*,video/*"
92onChange={handleFileUpload}
93style={{
175176// Additional server-side validation
177const allowedTypes = ['image/', 'video/'];
178const maxFileSize = 50 * 1024 * 1024; // 50MB
179