Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/image-url.jpg%20%22Optional%20title%22?q=function&page=70&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=function

Returns an array of strings in format "username" or "username/projectName"

Found 33110 results for "function"(4221ms)

m5_simple_launcherindex.ts6 matches

@dcm31โ€ขUpdated 5 days ago
79
80 // Fixed GFX Font Parser
81 function parseGFXFont(headerContent) {
82 try {
83 // Extract bitmap data
161
162 // Simple text renderer (just boxes for now to test glyph access)
163 function renderText(ctx, font, text, x, y, scale = 1, color = '#FFFFFF') {
164 if (!font || !font.glyphs || font.glyphs.length === 0) {
165 console.error('Invalid font object:', font);
215
216 // M5StickC Plus2 Simulator
217 function M5Simulator({ currentScreen, onButtonPress, currentAppIndex, totalApps, currentApp }) {
218 const canvasRef = useRef(null);
219 const [font, setFont] = useState(null);
224 // Load font on mount
225 useEffect(() => {
226 async function loadFont() {
227 try {
228 console.log('Loading font...');
373
374 // App Manager Component (same as before)
375 function AppManager({ apps, currentApp, onRunApp, onSendToM5 }) {
376 return (
377 <div className="p-4 bg-white rounded-lg shadow">
432
433 // Main App Component (same as before - keeping all the state management)
434 function App() {
435 const [apps, setApps] = useState({});
436 const [currentApp, setCurrentApp] = useState('launcher');

sandboxesCodeSandbox-just-rest.tsx1 match

@chadparkerโ€ขUpdated 5 days ago
1export default async function(req: Request) {
2 try {
3 const apiKey = Deno.env.get("codesandbox_io");

foundersmain.tsx7 matches

@joinโ€ขUpdated 5 days ago
11const DB_INIT_FLAG_KEY = "db_initialized_flag_v3";
12
13async function initializeDatabase() {
14 await sqlite.batch([
15 `CREATE TABLE IF NOT EXISTS schema_meta (
72}
73
74async function resetDatabase() {
75 await sqlite.batch([
76 "DROP TABLE IF EXISTS concierge_insights",
83}
84
85async function startupRoutine() {
86 const isInitialized = await blob.getJSON(DB_INIT_FLAG_KEY);
87 if (!isInitialized) {
123
124// --- FRONTEND GENERATION ---
125function Page({ initialState }) {
126 return (
127 <html lang="en">
220 const showLoading = (isLoading) => { $('#loading-indicator').style.display = isLoading ? 'block' : 'none'; };
221
222 async function apiCall(endpoint, body) {
223 showLoading(true);
224 try {
240 }
241
242 function render() {
243 const journeyContainer = $('#journey-stages');
244 journeyContainer.innerHTML = state.journey.map(j => \`
309
310// Helper to fetch full state
311async function getState() {
312 const journey = await sqlite.execute("SELECT stage, status FROM founder_journey ORDER BY ordering ASC");
313 const insights = await sqlite.execute(

m5_simple_launchergfx-font-renderer.ts3 matches

@dcm31โ€ขUpdated 5 days ago
20
21// Parse C header format font data
22export function parseGFXFont(headerContent: string): GFXFont {
23 // Extract bitmap data
24 const bitmapMatch = headerContent.match(/const uint8_t \w+Bitmaps\[\] PROGMEM = \{([^}]+)\}/);
73
74// Render a single character to ImageData
75export function renderGlyph(font: GFXFont, char: string): ImageData | null {
76 const charCode = char.charCodeAt(0);
77 if (charCode < font.first || charCode > font.last) return null;
112
113// Render text string to canvas
114export function renderText(
115 ctx: CanvasRenderingContext2D,
116 font: GFXFont,

untitled-301README.md1 match

@Mouhakโ€ขUpdated 5 days ago
15โ”‚ โ”œโ”€โ”€ database/
16โ”‚ โ”‚ โ”œโ”€โ”€ migrations.ts # Database schema setup
17โ”‚ โ”‚ โ””โ”€โ”€ queries.ts # Database query functions
18โ”‚ โ”œโ”€โ”€ routes/
19โ”‚ โ”‚ โ”œโ”€โ”€ jobs.ts # Job posting API routes

untitled-301queries.ts5 matches

@Mouhakโ€ขUpdated 5 days ago
4
5// Job queries
6export async function getAllJobs(): Promise<Job[]> {
7 const result = await sqlite.execute(`
8 SELECT * FROM ${JOBS_TABLE}
12}
13
14export async function createJob(job: Omit<Job, 'id' | 'created_at'>): Promise<Job> {
15 const result = await sqlite.execute(`
16 INSERT INTO ${JOBS_TABLE} (title, company, description, location, salary, contact_email)
25}
26
27export async function deleteJob(id: number): Promise<boolean> {
28 const result = await sqlite.execute(`
29 DELETE FROM ${JOBS_TABLE} WHERE id = ?
34
35// Chat queries
36export async function getRecentMessages(limit: number = 50): Promise<ChatMessage[]> {
37 const result = await sqlite.execute(`
38 SELECT * FROM ${CHAT_TABLE}
45}
46
47export async function createMessage(message: Omit<ChatMessage, 'id' | 'created_at'>): Promise<ChatMessage> {
48 const result = await sqlite.execute(`
49 INSERT INTO ${CHAT_TABLE} (username, message)

untitled-301migrations.ts1 match

@Mouhakโ€ขUpdated 5 days ago
5export const CHAT_TABLE = 'chat_messages_v1';
6
7export async function runMigrations() {
8 // Create jobs table
9 await sqlite.execute(`

untitled-301JobForm.tsx1 match

@Mouhakโ€ขUpdated 5 days ago
7}
8
9export default function JobForm({ onJobCreated }: JobFormProps) {
10 const [formData, setFormData] = useState({
11 title: '',

untitled-301JobBoard.tsx1 match

@Mouhakโ€ขUpdated 5 days ago
4import JobForm from "./JobForm.tsx";
5
6export default function JobBoard() {
7 const [jobs, setJobs] = useState<Job[]>([]);
8 const [loading, setLoading] = useState(true);

untitled-301ChatRoom.tsx1 match

@Mouhakโ€ขUpdated 5 days ago
3import type { ChatMessage, ApiResponse } from "../../shared/types.ts";
4
5export default function ChatRoom() {
6 const [messages, setMessages] = useState<ChatMessage[]>([]);
7 const [newMessage, setNewMessage] = useState('');

discordWebhook2 file matches

@stevekrouseโ€ขUpdated 3 days ago
Helper function to send Discord messages
tuna

tuna9 file matches

@jxnblkโ€ขUpdated 4 weeks ago
Simple functional CSS library for Val Town
lost1991
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": "*",
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.