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=29&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 24882 results for "function"(1602ms)

dprn-remixindex.ts5 matches

@angeltapes•Updated 19 hours ago
2
3// Simple template engine for processing Nunjucks-like templates
4function processTemplate(template: string, data: any): string {
5 let result = template;
6
39}
40
41function getNestedValue(obj: any, path: string): any {
42 return path.split('.').reduce((current, key) => {
43 if (current && typeof current === 'object') {
48}
49
50function evaluateCondition(condition: string, data: any): boolean {
51 // Simple condition evaluation - just check if variable exists and is truthy
52 const value = getNestedValue(data, condition);
164};
165
166function formatDate(date: Date): string {
167 return date.toLocaleDateString('en-US', {
168 year: 'numeric',
172}
173
174export default async function(req: Request): Promise<Response> {
175 const url = new URL(req.url);
176 const path = url.pathname;

dprn-remix.eleventy.js3 matches

@angeltapes•Updated 19 hours ago
1const { DateTime } = require("luxon");
2
3module.exports = function(eleventyConfig) {
4 // Copy static assets
5 eleventyConfig.addPassthroughCopy("src/css");
33
34 // Create a collection for blog posts
35 eleventyConfig.addCollection("posts", function(collectionApi) {
36 return collectionApi.getFilteredByGlob("src/posts/*.md").sort((a, b) => {
37 return b.date - a.date; // Sort by date descending
40
41 // Create a collection for featured posts
42 eleventyConfig.addCollection("featuredPosts", function(collectionApi) {
43 return collectionApi.getFilteredByGlob("src/posts/*.md")
44 .filter(post => post.data.featured)

dprn-remixbuilding-with-eleventy.md1 match

@angeltapes•Updated 19 hours ago
29```javascript
30// In .eleventy.js
31eleventyConfig.addCollection("posts", function(collectionApi) {
32 return collectionApi.getFilteredByGlob("src/posts/*.md");
33});

dprnprism-base16-monokai.dark.css1 match

@angeltapes•Updated 19 hours ago
97.token.atrule,
98.token.attr-value,
99.token.function,
100.token.class-name {
101 color: #e6db74;

dprnmarkdown-guide.md1 match

@angeltapes•Updated 19 hours ago
50Block code:
51```javascript
52function greet(name) {
53 return `Hello, ${name}!`;
54}

dprnbuilding-with-eleventy.md1 match

@angeltapes•Updated 19 hours ago
29```javascript
30// In .eleventy.js
31eleventyConfig.addCollection("posts", function(collectionApi) {
32 return collectionApi.getFilteredByGlob("src/posts/*.md");
33});

dprnwelcome-to-my-blog.md1 match

@angeltapes•Updated 19 hours ago
44```javascript
45// Here's some sample code with syntax highlighting
46function welcomeMessage(name) {
47 return `Welcome to the blog, ${name}!`;
48}

LOGINPAGEACCqueries.ts5 matches

@musakiplagat•Updated 19 hours ago
3import type { User, Session } from "../../shared/types.ts";
4
5export async function authenticateUser(username: string, password: string): Promise<User | null> {
6 const passwordHash = await hashPassword(password);
7
34}
35
36export async function createSession(userId: number, username: string): Promise<string> {
37 const sessionId = crypto.randomUUID();
38 const expiresAt = new Date();
47}
48
49export async function validateSession(sessionId: string): Promise<Session | null> {
50 const result = await sqlite.execute(
51 `SELECT id, user_id, username, created_at, expires_at FROM ${SESSIONS_TABLE}
68}
69
70export async function deleteSession(sessionId: string): Promise<void> {
71 await sqlite.execute(
72 `DELETE FROM ${SESSIONS_TABLE} WHERE id = ?`,
75}
76
77export async function getUserById(userId: number): Promise<User | null> {
78 const result = await sqlite.execute(
79 `SELECT id, username, email, created_at, last_login FROM ${USERS_TABLE} WHERE id = ?`,

LOGINPAGEACCindex.tsx1 match

@musakiplagat•Updated 19 hours ago
12}
13
14function App() {
15 const [state, setState] = useState<AppState>({
16 isAuthenticated: false,

LOGINPAGEACCDashboard.tsx1 match

@musakiplagat•Updated 19 hours ago
8}
9
10export default function Dashboard({ user, onLogout }: DashboardProps) {
11 const handleLogout = async () => {
12 try {

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.