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/?q=function&page=808&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 10261 results for "function"(643ms)

luminousOrangeDingomain.tsx1 match

@toowired•Updated 2 months ago
69
70// Export for Val Town
71export async function test(args) {
72 return await runTests();
73}

tangibleBrownPtarmiganmain.tsx7 matches

@toowired•Updated 2 months ago
1import { blob } from '@val.town/utils';
2
3export async function windsurfIDE(args) {
4 const { type, ...params } = args;
5
22}
23
24async function handleStartGoal(goal) {
25 const state = await blob.get('windsurf_state') || {
26 goals: [],
58}
59
60async function handleCompleteTask(taskId) {
61 const state = await blob.get('windsurf_state');
62 if (!state) return { error: 'No active state' };
82}
83
84async function handleAutoNext() {
85 const state = await blob.get('windsurf_state');
86 if (!state || !state.currentGoal) return { status: "NO_ACTIVE_GOAL" };
116}
117
118async function loadMemory(memoryId) {
119 const state = await blob.get('windsurf_state');
120 if (!state) return { error: 'No active state' };
136}
137
138async function applyRule(rule, target, state) {
139 // Rule application logic
140 switch(rule.action) {
155}
156
157function prioritizeTask(task, state, criteria) {
158 // Task prioritization logic based on rules
159 return task;

bubblyMaroonLungfishmain.tsx1 match

@toowired•Updated 2 months ago
69
70// Export for Val Town
71export async function test(args) {
72 return await runTests();
73}

alluringSapphireStoatmain.tsx1 match

@toowired•Updated 2 months ago
69
70// Export for Val Town
71export async function test(args) {
72 return await runTests();
73}

Windsurfcontextmanager4 matches

@toowired•Updated 2 months ago
16
17// Context Manager Val
18export async function updateContext(context) {
19 const { phase, activeBlocks, pendingTasks, recentChanges } = context;
20
35}
36
37export async function getLatestContext() {
38 const result = db.prepare(`
39 SELECT * FROM context
53}
54
55export async function getContextHistory(limit = 10) {
56 return db.prepare(`
57 SELECT * FROM context
62
63// HTTP request handler
64export async function onRequest(req) {
65 const { action, params } = await req.json();
66

Windsurfprojectcontext12 matches

@toowired•Updated 2 months ago
45 * @returns {React.ReactElement}
46 */
47function App() {
48 const [state, setState] = useState(null);
49 const [error, setError] = useState(null);
112/**
113 * CurrentPhase component
114 * @param {{phase: string, onUpdate: Function}} props
115 * @returns {React.ReactElement}
116 */
117function CurrentPhase({ phase, onUpdate }) {
118 const [newPhase, setNewPhase] = useState(phase);
119 const [error, setError] = useState("");
152/**
153 * ActiveBlocks component
154 * @param {{blocks: string[], onUpdate: Function}} props
155 * @returns {React.ReactElement}
156 */
157function ActiveBlocks({ blocks, onUpdate }) {
158 const [newBlock, setNewBlock] = useState("");
159 const [error, setError] = useState("");
210/**
211 * TaskList component
212 * @param {{tasks: Task[], onUpdate: Function}} props
213 * @returns {React.ReactElement}
214 */
215function TaskList({ tasks, onUpdate }) {
216 const [newTask, setNewTask] = useState({ description: "", priority: "medium", assignedTo: "" });
217 const [error, setError] = useState("");
338/**
339 * StepList component
340 * @param {{steps: Step[], onUpdate: Function}} props
341 * @returns {React.ReactElement}
342 */
343function StepList({ steps, onUpdate }) {
344 const [newStep, setNewStep] = useState({ description: "", priority: "medium" });
345 const [error, setError] = useState("");
455 * @returns {React.ReactElement}
456 */
457function ChangeList({ changes }) {
458 return (
459 <div className="section">
473 * Client-side initialization
474 */
475function client() {
476 createRoot(document.getElementById("root")).render(<App />);
477}
487 * @returns {Promise<Response>} The server response
488 */
489export default async function server(req: Request): Promise<Response> {
490 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
491 const { blob } = await import("https://esm.town/v/std/blob");

WindsurfunbeatableAquaCow4 matches

@toowired•Updated 2 months ago
1export default async function (req: Request): Promise<Response> {
2 return Response.json({ ok: true })
3 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
58 `);
59
60 // Utility functions
61 async function hashPassword(password: string, salt?: string): Promise<{ hash: string, salt: string }> {
62 salt = salt || crypto.randomUUID();
63 const encoder = new TextEncoder();
69 }
70
71 async function authenticateUser(request: Request): Promise<number | null> {
72 const authHeader = request.headers.get('Authorization');
73 if (!authHeader) return null;

OpenAIChatCompletionmain.tsx1 match

@rozek•Updated 2 months ago
9/**** rate-limited access to the OpenAI API ****/
10
11 export default async function (Request:Request):Promise<Response> {
12 if (Request.method === 'OPTIONS') {
13 return new Response(null, {

blueskyBotTutorialblueskyScheduler1 match

@charmaine•Updated 2 months ago
1import { postToBluesky } from "./blueskyPost";
2
3export default async function(interval: Interval) {
4 await postToBluesky();
5}

blueskyBotTutorialblueskyPost1 match

@charmaine•Updated 2 months ago
1import { BskyAgent } from "npm:@atproto/api";
2
3export async function postToBluesky() {
4 const agent = new BskyAgent({
5 service: "https://bsky.social",

getFileEmail4 file matches

@shouser•Updated 1 week ago
A helper function to build a file's email

TwilioHelperFunctions

@vawogbemi•Updated 2 months ago