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=1579&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 19855 results for "function"(5197ms)

dailyPeachSalmonmain.tsx1 match

@apppeak•Updated 8 months ago
12};
13
14export default async function(interval: Interval) {
15 const response = await notion.databases.query({
16 database_id: DATABASE_ID,

notionRecurringTasksmain.tsx1 match

@apppeak•Updated 8 months ago
12};
13
14export default async function(interval: Interval) {
15 const response = await notion.databases.query({
16 database_id: DATABASE_ID,

redBallComponentmain.tsx2 matches

@arthrod•Updated 8 months ago
19`;
20
21export default async function server(request: Request): Promise<Response> {
22 return new Response(
23 `
44 <div id="root"></div>
45 <script type="text/babel">
46 function RedBall() {
47 return (
48 <div

merchantAnalysisPromptmain.tsx1 match

@mjweaver01•Updated 8 months ago
18
19- pie: Syntax Drawing a pie chart is really simple in mermaid. Start with pie keyword to begin the diagram showData to render the actual data values after the legend text. This is OPTIONAL Followed by title keyword and its value in string to give a title to the pie-chart. This is OPTIONAL Followed by dataSet. Pie slices will be ordered clockwise in the same order as the labels. label for a section in the pie diagram within " " quotes. Followed by : colon as separator Followed by positive numeric value (supported up to two decimal places) [pie] [showData] (OPTIONAL) [title] [titlevalue] (OPTIONAL) "[datakey1]" : [dataValue1] "[datakey2]" : [dataValue2] "[datakey3]" : [dataValue3]
20- xychart-beta: Syntax INFO All text values that contain only one word can be written without ". If a text value has many words in it, specifically if it contains spaces, enclose the value in " Orientations The chart can be drawn horizontal or vertical, default value is vertical. xychart-beta horizontal ... Title The title is a short description of the chart and it will always render on top of the chart. Example xychart-beta title "This is a simple example" ... INFO If the title is a single word one no need to use ", but if it has space " is needed x-axis The x-axis primarily serves as a categorical value, although it can also function as a numeric range value when needed. Example x-axis title min --> max x-axis will function as numeric with the given range x-axis "title with space" [cat1, "cat2 with space", cat3] x-axis if categorical, categories are text type y-axis The y-axis is employed to represent numerical range values, it cannot have categorical values. Example y-axis title min --> max y-axis title it will only add the title, the range will be auto generated from data. INFO Both x and y axis are optional if not provided we will try to create the range Line chart A line chart offers the capability to graphically depict lines. Example line [2.3, 45, .98, -3.4] it can have all valid numeric values. Bar chart A bar chart offers the capability to graphically depict bars. Example bar [2.3, 45, .98, -3.4] it can have all valid numeric values. Simplest example The only two things required are the chart name (xychart-beta) and one data set. So you will be able to draw a chart with a simple config like xychart-beta line [+1.3, .6, 2.4, -.34]
21
22Some good examples for mermaid charts are:

AlgoliaInstantSearchWebsitemain.tsx5 matches

@willthereader•Updated 8 months ago
2import { configure, hits, pagination, searchBox } from "https://esm.sh/instantsearch.js@4.49.1/es/widgets";
3
4function validateConfig(): { appId: string; apiKey: string } {
5 const appId = Deno.env.get("ALGOLIA_APP_ID");
6 const apiKey = Deno.env.get("ALGOLIA_SEARCH_API_KEY");
13}
14
15function generateHtml(appId: string, apiKey: string): string {
16 console.log("Generating HTML with App ID:", appId, "and API Key:", apiKey ? "exists" : "missing");
17 return `
92 container: '#hits',
93 templates: {
94 item: function(hit) {
95 console.log('Hit:', hit); // Add this line
96 return '<div class="hit">' +
116}
117
118function handleError(error: Error): Response {
119 console.error("Server error:", error);
120 return new Response(`Error: ${error.message}`, { status: 500 });
121}
122
123async function handleRequest(request: Request): Promise<Response> {
124 console.log("Received request:", request.url);
125 try {

InstantSearchAlgoliaStoryTestmain.tsx5 matches

@willthereader•Updated 8 months ago
2import { configure, hits, pagination, searchBox } from "https://esm.sh/instantsearch.js@4.49.1/es/widgets";
3
4function validateConfig(): { appId: string; apiKey: string } {
5 const appId = Deno.env.get("ALGOLIA_APP_ID");
6 const apiKey = Deno.env.get("ALGOLIA_SEARCH_API_KEY");
13}
14
15function generateHtml(appId: string, apiKey: string): string {
16 console.log("Generating HTML with App ID:", appId, "and API Key:", apiKey ? "exists" : "missing");
17 return `
92 container: '#hits',
93 templates: {
94 item: function(hit) {
95 console.log('Hit:', hit); // Add this line
96 return '<div class="hit">' +
116}
117
118function handleError(error: Error): Response {
119 console.error("Server error:", error);
120 return new Response(`Error: ${error.message}`, { status: 500 });
121}
122
123async function handleRequest(request: Request): Promise<Response> {
124 console.log("Received request:", request.url);
125 try {

splendidSapphireMockingbirdmain.tsx1 match

@maxm•Updated 8 months ago
1export default async function (req: Request): Promise<Response> {
2 console.log(req)
3 return Response.json({ ok: true })

multirouteHTMLmain.tsx10 matches

@iamseeley•Updated 8 months ago
8import { generateTrackingHtml } from 'https://esm.town/v/iamseeley/counterTown';
9
10export default async function (req: Request): Promise<Response> {
11 const url = new URL(req.url);
12 const path = url.pathname;
13
14 // Function to create navigation links with active state
15 function createNavLinks(currentPath: string): string {
16 const links = [
17 { path: '/', text: 'Home' },
29
30 // Common HTML structure
31 function createHTML(title: string, content: string, req: Request): string {
32 return `
33 <!DOCTYPE html>
69 }
70
71 // Router function to handle different routes
72 function router(path: string, req: Request): Response {
73 switch (path) {
74 case '/':
84
85 // Home page
86 function homePage(req: Request): Response {
87 const content = `
88 <h2>Welcome to My Portfolio</h2>
98
99 // About page
100 function aboutPage(req: Request): Response {
101 const content = `
102 <h2>About Me</h2>
109
110 // Projects page
111 function projectsPage(req: Request): Response {
112 const content = `
113 <h2>My Projects</h2>
127
128 // 404 Not Found page
129 function notFoundPage(req: Request): Response {
130 const content = `
131 <h2>404 Not Found</h2>

faviconGeneratormain.tsx4 matches

@iamseeley•Updated 8 months ago
6import { createRoot } from "https://esm.sh/react-dom/client";
7
8function App() {
9 const [prompt, setPrompt] = useState("");
10 const [faviconUrl, setFaviconUrl] = useState("");
66}
67
68function client() {
69 createRoot(document.getElementById("root")).render(<App />);
70}
74}
75
76async function generateImage(prompt: string) {
77 const FAL_KEY = Deno.env.get("FAL_KEY");
78 if (!FAL_KEY) {
112}
113
114export default async function server(request: Request): Promise<Response> {
115 const url = new URL(request.url);
116 const pathname = url.pathname;

valWallmain.tsx6 matches

@yawnxyz•Updated 8 months ago
69
70
71async function generateGraph(username, useVersions = true) {
72 if (!username) {
73 return html`<p class="text-red-500">Please enter a username</p>`;
111}
112
113function renderPage(c, initialUsername = null) {
114 return c.html(html`
115 <!DOCTYPE html>
163 `);
164}
165function generateMonthLabels(contributionData) {
166 const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
167 const today = dayjs();
197}
198
199function generateContributionRows(contributionData) {
200 const dayLabels = ['', 'Mon', '', 'Wed', '', 'Fri', ''];
201 let rows = [];
212 return rows;
213}
214function generateContributionCells(contributionData, dayOfWeek) {
215 let cells = [];
216 for (let i = dayOfWeek; i < contributionData.length; i += 7) {
235 return cells;
236}
237function processVals(vals, useVersions) {
238 const today = new Date();
239 const oneYearAgo = new Date(today.getFullYear() - 1, today.getMonth(), today.getDate());

getFileEmail4 file matches

@shouser•Updated 3 weeks ago
A helper function to build a file's email
tuna

tuna8 file matches

@jxnblk•Updated 3 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.