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=1609&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 19320 results for "function"(3304ms)

1// I can help you with TypeScript code. For creating an HTML Wordle game with CSS, it's best to use a live HTML editor like CodePen or JSFiddle to see the rendering in action. Feel free to copy the following HTML, CSS, and JavaScript code into an HTML file and open it in a browser to see the styling and functionality:
2
3// HTML
56 let attempts = 0;
57
58 document.getElementById("wordleForm").addEventListener("submit", function (e) {
59 e.preventDefault();
60 const guess = this.children[0].value.toUpperCase();
85
86// script.js
87// Implement the Wordle game logic here to make the game interactive and functional.
88// This script would handle user input, check against the target word, and provide feedback to the user.
89
52let tries = 0;
53
54function checkGuess() {
55 const guess = document.getElementById('wordle-input').value.trim().toLowerCase();
56
45 let guesses = 0;
46
47 function checkWord() {
48 const guess = document.getElementById("word").value.toLowerCase();
49
52 let guessedWord = "_____";
53
54 function checkGuess() {
55 const guess = document.querySelector(".input").value.toLowerCase();
56 if (guess.length !== 5 || new Set(guess).size !== 5) {
78 }
79
80 function resetGame() {
81 guessedWord = "_____";
82 document.querySelector(".word").textContent = guessedWord;
60 const word = "apple"; // Assumes the word to guess is "apple"
61
62 function checkGuess() {
63 const guess = document.getElementById("guess").value.toLowerCase();
64 let count = 0;
74 }
75
76 function displayResult(count) {
77 let resultText = "";
78

VALLEmain.tsx8 matches

@pomdtr•Updated 10 months ago
27the simplest way to achieve the goal, though you can add some inline comments to explain your
28reasoning (not for every line, but for major groups of lines). Don't use any environment variables
29unless strictly necessary, for example use APIs that don't require a key, prefer internal function
30imports (using esm.town), and prefer putting API keys as inline variables. Use built-in Deno
31functions where possible. Unless specified, don't add error handling,
32make sure that errors bubble up to the caller.
33There should be no comments like "more content here", it should be complete and directly runnable.
35
36// Your response should start with \`\`\`ts and end with \`\`\`.
37// The val should create a "export default async function main() {" which
38// is the main function that gets executed, without any arguments. Don't return a Response object,
39// just return a plain Javascript object, array, or string.
40
68 const writer = writable.getWriter();
69 const textEncoder = new TextEncoder();
70 function write(text) {
71 writer.write(textEncoder.encode(text));
72 }
115 </div>
116 <script>
117 function openTab(tab) {
118 const tabButtonCode = document.getElementById("tab-button-code");
119 const tabButtonPreview = document.getElementById("tab-button-preview");
139 (() => {
140 const scrollingElement = document.getElementById("conversation-container");
141 const callback = function (mutationsList, observer) {
142 scrollingElement.scrollTo({ left: 0, top: scrollingElement.scrollHeight, behavior: "instant" });
143 };
213 document.getElementById("code-textarea").value = "";
214 let fullStr = "";
215 window.addToken = function(str) {
216 fullStr += str;
217 const code = fullStr.replaceAll("\`\`\`ts\\n", "").replaceAll("\`\`\`", "");
5// The CSS will add the weird and fun styling parts.
6
7export default async function wordleGame() {
8 const html = `
9 <!DOCTYPE html>
4 */
5
6export default async function(wordleGame(req: Request): Promise<Response> {
7 const html = `
8<!DOCTYPE html>
72 const input = document.getElementById('guess-input');
73
74 function createBoard() {
75 for (let i = 0; i < 30; i++) {
76 const cell = document.createElement('div');
80 }
81
82 function makeGuess() {
83 const guess = input.value.toLowerCase();
84 if (guess.length !== 5) return alert("Guess should be 5 letters!");

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.