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/$%7Burl%7D?q=function&page=2356&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 27947 results for "function"(4521ms)

GDI_DeepThoughtREADME.md2 matches

@rozek•Updated 7 months ago
7
8It contains a simple web page which basically does nothing special but
9demonstrates how to import a function exported from another val.
10
11This val is the companion of
13[https://www.val.town/v/rozek/GDI_deepThinkAbout/](https://www.val.town/v/rozek/GDI_deepThinkAbout)
14
15which contains the function imported by this example.
16
17The code was created using Townie - with only a few small manual corrections.

GDI_deepThinkAboutmain.tsx1 match

@rozek•Updated 7 months ago
1export default function deepThinkAbout (Question:string):string {
2 return "42" // unfortunately, we cannot wait 7.5 million years...
3}

GDI_deepThinkAboutREADME.md2 matches

@rozek•Updated 7 months ago
6frontend and backend.
7
8It contains a single function which is exported in order to be used by other
9code (e.g., other vals).
10
13[https://www.val.town/v/rozek/GDI_DeepThought/](https://www.val.town/v/rozek/GDI_DeepThought/)
14
15which imports this function and invokes it.
16
17The code was created using Townie - with only a few small manual corrections.

segYPlottermain.tsx7 matches

@efoley•Updated 7 months ago
5import { blob } from "https://esm.town/v/std/blob";
6
7function percentileScale(
8 data: number[][],
9 lowerPercentile: number = 1,
25}
26
27function PlotComponent({ data, percentile }) {
28 useEffect(() => {
29 // log percentile
75}
76
77function App() {
78 const [segyData, setSegyData] = useState(null);
79 const [isLoading, setIsLoading] = useState(true);
169}
170
171function client() {
172 createRoot(document.getElementById("root")).render(<App />);
173}
198
199/**
200 * Function to process SEG-Y data passed as a Uint8Array
201 * @param {Uint8Array} data - The binary content of the SEG-Y file as Uint8Array
202 */
203function processSEGY(arrayBuffer) {
204 // Call parseSegy with the ArrayBuffer
205 const traces = parseSegy(arrayBuffer);
211}
212
213export default async function server(request: Request): Promise<Response> {
214 const url = new URL(request.url);
215

dateme_react_hydratedmain.tsx1 match

@stevekrouse•Updated 7 months ago
10import { html } from "https://esm.town/v/stevekrouse/html";
11
12export default async function(req: Request) {
13 let handler = createStaticHandler(routes);
14 let context = await handler.query(req);

weatherGPTmain.tsx1 match

@kevinforrestconnors•Updated 7 months ago
31console.log(text);
32
33export async function weatherGPT() {
34 await email({ subject: "Weather Today", text });
35}

stripFencesmain.tsx1 match

@stevekrouse•Updated 7 months ago
1export default function stripFences(content: string) {
2 return content.replace(/```[\s\S]*?\n([\s\S]*?)\n```/g, "$1");
3}

monacoEditormain.tsx2 matches

@yawnxyz•Updated 7 months ago
54 // Initialize Monaco Editor without RequireJS
55 window.require.config({ paths: { 'vs': 'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.51.0/min/vs' } });
56 window.require(['vs/editor/editor.main'], function () {
57 // Define a custom Monokai Light theme
58 monaco.editor.defineTheme('monokai-light', {
66 { token: 'number', foreground: 'ae81ff' },
67 { token: 'type', foreground: '66d9ef' }, // Lightened blue
68 { token: 'function', foreground: 'a6e22e' }, // Lightened green
69 ],
70 colors: {

GDI_ClientInfomain.tsx3 matches

@rozek•Updated 7 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const [details, setDetails] = useState("");
7 const [isLoading, setIsLoading] = useState(false);
40}
41
42function client() {
43 createRoot(document.getElementById("root")).render(<App />);
44}
48}
49
50export default async function server(request: Request): Promise<Response> {
51 return new Response(
52 `

GDI_ClientInfoServicemain.tsx1 match

@rozek•Updated 7 months ago
1export default async function (req: Request): Promise<Response> {
2 const headers = req.headers;
3 const url = new URL(req.url);

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.