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/$%7Bart_info.art.src%7D?q=function&page=71&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 24194 results for "function"(827ms)

timeindex.ts1 match

@flymasterโ€ขUpdated 2 days ago
1export default async function (req: Request): Promise<Response> {
2 // Get current time in US/NewYork timezone
3 const now = new Date();

ProtoShareauth.ts8 matches

@c15rโ€ขUpdated 2 days ago
28const auth = new Hono();
29
30// Helper functions for WebAuthn
31function generateChallenge(): string {
32 const array = new Uint8Array(32);
33 crypto.getRandomValues(array);
35}
36
37function generateId(): string {
38 return crypto.randomUUID();
39}
40
41function arrayBufferToBase64(buffer: ArrayBuffer): string {
42 const bytes = new Uint8Array(buffer);
43 let binary = '';
48}
49
50function base64ToArrayBuffer(base64: string): ArrayBuffer {
51 const binary = atob(base64.replace(/-/g, '+').replace(/_/g, '/'));
52 const bytes = new Uint8Array(binary.length);
58
59// Simplified WebAuthn verification (in production, use a proper library)
60async function verifyRegistration(credential: any, challenge: string): Promise<{ verified: boolean; credentialId: string; publicKey: string }> {
61 try {
62 const clientDataJSON = JSON.parse(new TextDecoder().decode(base64ToArrayBuffer(credential.response.clientDataJSON)));
83}
84
85async function verifyAuthentication(credential: any, challenge: string, storedCredential: any): Promise<boolean> {
86 try {
87 const clientDataJSON = JSON.parse(new TextDecoder().decode(base64ToArrayBuffer(credential.response.clientDataJSON)));
107
108// Middleware to check authentication
109async function requireAuth(c: any, next: any) {
110 const sessionToken = getCookie(c, 'session');
111 if (!sessionToken) {

ProtoShareApp.tsx3 matches

@c15rโ€ขUpdated 2 days ago
25}
26
27export function App() {
28 const [user, setUser] = useState<User | null>(null);
29 const [pageType, setPageType] = useState<string>('app');
93}
94
95function UnauthenticatedView() {
96 return (
97 <div className="min-h-screen bg-gray-50">
130 <p className="text-lg text-gray-600 mb-6">
131 This backend receives and stores content shared from iOS devices
132 using the Share Sheet functionality.
133 </p>
134 <div className="grid md:grid-cols-2 gap-6 text-left">

ProtoShareSetup.tsx1 match

@c15rโ€ขUpdated 2 days ago
20}
21
22export function Setup({ user }: SetupProps) {
23 const [tokens, setTokens] = useState<BearerToken[]>([]);
24 const [selectedToken, setSelectedToken] = useState<string>('');

ProtoShareAdmin.tsx1 match

@c15rโ€ขUpdated 2 days ago
38}
39
40export function Admin({ user }: AdminProps) {
41 const [stats, setStats] = useState<AdminStats | null>(null);
42 const [users, setUsers] = useState<User[]>([]);

ProtoShareDashboard.tsx1 match

@c15rโ€ขUpdated 2 days ago
29}
30
31export function Dashboard({ user }: DashboardProps) {
32 const [content, setContent] = useState<ContentItem[]>([]);
33 const [tokens, setTokens] = useState<BearerToken[]>([]);

untitled-5165course.html1 match

@Tinuโ€ขUpdated 2 days ago
166 <script>
167 // Load course data when page loads
168 document.addEventListener('DOMContentLoaded', function() {
169 const courseData = window.__COURSE_DATA__;
170

untitled-5165index.html2 matches

@Tinuโ€ขUpdated 2 days ago
642
643 <script>
644 function showCourse(courseId) {
645 // Redirect to course page
646 window.location.href = `/courses/${courseId}`;
649 // Smooth scrolling for anchor links
650 document.querySelectorAll('a[href^="#"]').forEach(anchor => {
651 anchor.addEventListener('click', function (e) {
652 e.preventDefault();
653 const target = document.querySelector(this.getAttribute('href'));

iptvREADME.md1 match

@adalante35โ€ขUpdated 2 days ago
56โ”œโ”€โ”€ shared/
57โ”‚ โ”œโ”€โ”€ types.ts # TypeScript interfaces and types
58โ”‚ โ””โ”€โ”€ utils.ts # Shared utility functions
59โ””โ”€โ”€ README.md
60```

iptvindex.tsx1 match

@adalante35โ€ขUpdated 2 days ago
30}
31
32function App() {
33 const [state, setState] = useState<AppState>({
34 channels: window.__INITIAL_DATA__?.channels || [],

getFileEmail4 file matches

@shouserโ€ขUpdated 1 month ago
A helper function to build a file's email
tuna

tuna8 file matches

@jxnblkโ€ขUpdated 1 month 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.