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=1607&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 18979 results for "function"(2959ms)

chocolateCanidmain.tsx3 matches

@willthereader•Updated 11 months ago
11
12const clientCode = () => {
13 document.getElementById("input").addEventListener("submit", async function(event) {
14 event.preventDefault();
15
47 }`,
48 );
49 eventSource.onmessage = function(event) {
50 responseDiv.innerText += JSON.parse(event.data);
51 };
52
53 eventSource.onerror = function() {
54 eventSource.close();
55 };

vt_playground_demomain.tsx1 match

@pomdtr•Updated 11 months ago
24`;
25
26export default function() {
27 return new Response(body, {
28 headers: {

coralCarpmain.tsx3 matches

@willthereader•Updated 11 months ago
10
11const clientCode = () => {
12 document.getElementById("input").addEventListener("submit", function(event) {
13 event.preventDefault();
14
34 + `&assistantId=${input.getAttribute("data-assistant-id")}`,
35 );
36 eventSource.onmessage = function(event) {
37 console.log(event);
38 responseDiv.innerText += JSON.parse(event.data);
39 };
40
41 eventSource.onerror = function() {
42 eventSource.close();
43 };

emeraldRaccoonmain.tsx3 matches

@willthereader•Updated 11 months ago
10
11const clientCode = () => {
12 document.getElementById("input").addEventListener("submit", function(event) {
13 event.preventDefault();
14
34 + `&assistantId=${input.getAttribute("data-assistant-id")}`,
35 );
36 eventSource.onmessage = function(event) {
37 console.log(event);
38 responseDiv.innerText += JSON.parse(event.data);
39 };
40
41 eventSource.onerror = function() {
42 eventSource.close();
43 };

valTownChatGPTmain.tsx3 matches

@willthereader•Updated 11 months ago
10
11const clientCode = () => {
12 document.getElementById("input").addEventListener("submit", function(event) {
13 event.preventDefault();
14
34 + `&assistantId=${input.getAttribute("data-assistant-id")}`,
35 );
36 eventSource.onmessage = function(event) {
37 console.log(event);
38 responseDiv.innerText += JSON.parse(event.data);
39 };
40
41 eventSource.onerror = function() {
42 eventSource.close();
43 };

zwjEmojimain.tsx1 match

@stevekrouse•Updated 11 months ago
3const EMOJI_DATA_URL = "https://unicode.org/Public/emoji/15.1/emoji-zwj-sequences.txt";
4
5export async function getCompoundEmojis(): Promise<string[]> {
6 const data = await fetchText(EMOJI_DATA_URL);
7 let result: string[] = [];

valBackupmain.tsx6 matches

@iamseeley•Updated 11 months ago
10const gitHubAPI = new GitHubAPI(GITHUB_TOKEN);
11
12async function fetchVals() {
13 const response = await valTownAPI.getAllVals();
14 return response.data;
15}
16
17async function getExistingFiles() {
18 console.log(`Fetching existing files from repo: ${GITHUB_REPO}, branch: ${GITHUB_BRANCH}`);
19 try {
27}
28
29async function getLastBackupDates() {
30 const files = await getExistingFiles();
31 const lastModifiedDates = {};
39}
40
41async function updateOrCreateFile(filePath, fileContent, commitMessage) {
42 const existingFiles = await getExistingFiles();
43 const fileExists = existingFiles.includes(filePath);
71
72
73async function backupVals() {
74 const vals = await fetchVals();
75 const lastBackupDates = await getLastBackupDates();
104}
105
106export async function runBackupIfChanged() {
107 const vals = await fetchVals();
108 const lastBackupDates = await getLastBackupDates();

spotifymain.tsx1 match

@anthonyec•Updated 11 months ago
125});
126
127async function getToken(c) {
128 const state = c.req.query("state") as string;
129 const authData = await db.select().from(table).where(eq(table.id, state)).limit(1);

pythonmain.tsx1 match

@pomdtr•Updated 11 months ago
5(globalThis as any).navigator = {};
6
7export async function loadPython(params?: { packages: string[] }) {
8 const pyodide = await pyodideModule.loadPyodide();
9 for (const pkg of params?.packages || []) {

spotifymain.tsx1 match

@niek•Updated 11 months ago
125});
126
127async function getToken(c) {
128 const state = c.req.query("state") as string;
129 const authData = await db.select().from(table).where(eq(table.id, state)).limit(1);

getFileEmail4 file matches

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

tuna8 file matches

@jxnblk•Updated 2 weeks ago
Simple functional CSS library for Val Town
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
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": "*",