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/$%7Bsuccess?q=function&page=1671&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 20408 results for "function"(3424ms)

emailmain.tsx1 match

@shouser•Updated 8 months ago
12 * The email address(es) to send the email to. Only available to Val Town Pro subscribers.
13 * Can be a single string, IAddress object, or an array of strings/IAddress objects.
14 * @default the email of the logged user calling this function.
15 */
16 to?: (IAddress | string)[] | IAddress | string;

reluctantCoffeeGayalmain.tsx10 matches

@kaz•Updated 8 months ago
28 "Have the ability to murder anyone without any consequences",
29 "Have a tight knit and loyal friend group",
30 "Have another set of eyes in the back of your head (they are fully functional)",
31 "Have a very physically attractive romantic partner",
32 "Be able to spawn pizzas by snapping your fingers (max 2 per 12 hours)",
36];
37
38function App() {
39 const [user, setUser] = useState<User | null>(null);
40 const [answers, setAnswers] = useState<Answer[]>([]);
106}
107
108function SplashScreen({ onGetStarted }: { onGetStarted: () => void }) {
109 return (
110 <div className="splash-screen">
132}
133
134function TabBar() {
135 const location = useLocation();
136 const tabs = [
163}
164
165function Game({ user, saveAnswer }: { user: User | null; saveAnswer: (answer: Answer, losingAnswer: string) => void }) {
166 const getRandomQuestion = useCallback((): Question => {
167 const availableOptions = [...ANSWER_OPTIONS];
198}
199
200function Answers(
201 { user, answers, rankings, clearAnswers }: {
202 user: User | null;
237}
238
239function Profile({ user, setUser }: { user: User | null; setUser: (user: User | null) => void }) {
240 const [username, setUsername] = useState("");
241
277}
278
279function client() {
280 createRoot(document.getElementById("root")!).render(<App />);
281}
285}
286
287async function server(request: Request): Promise<Response> {
288 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
289 const KEY = "reluctantCoffeeGayal";
369}
370
371async function updateEloRankings(sqlite: any, KEY: string, winningAnswer: string, losingAnswer: string) {
372 const K = 32; // This is the maximum score change per match
373

fancyPlumSquirrelmain.tsx3 matches

@cofsana•Updated 8 months ago
9import { createRoot } from "https://esm.sh/react-dom/client";
10
11function App() {
12 const [panelMembers, setPanelMembers] = useState([]);
13 const [newMember, setNewMember] = useState({ name: "", expertise: "" });
116}
117
118function client() {
119 createRoot(document.getElementById("root")).render(<App />);
120}
124}
125
126async function server(request: Request): Promise<Response> {
127 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
128 const KEY = "fancyPlumSquirrel";

TufteCSSmain.tsx3 matches

@all•Updated 8 months ago
10import { createRoot } from "https://esm.sh/react-dom/client";
11
12function App() {
13 const [layoutType, setLayoutType] = useState('flexbox');
14 const [flexDirection, setFlexDirection] = useState('row');
126}
127
128function client() {
129 createRoot(document.getElementById("root")).render(<App />);
130}
134}
135
136export default async function server(request: Request): Promise<Response> {
137 return new Response(
138 `

litepickbetmain.tsx5 matches

@cyrilos•Updated 8 months ago
296 /* events */
297
298 /* run function on win */
299 onWin(func) {
300 this.winHandlers.push(func);
301 }
302
303 /* run function on loss */
304 onLoss(func) {
305 this.lossHandlers.push(func);
306 }
307
308 /* run function on every bet */
309 onBet(func) {
310 this.betHandlers.push(func);
323/* main app */
324
325async function loop() {
326 var url = "https://cyrilos-litepickbet.web.val.run";
327 await axios({
332
333/* bet session */
334async function playDice() {
335 const PLATFORM = "litepick.io";
336 const cookies = await blob.getJSON("cookies");

neverthrowREADME.md2 matches

@cofsana•Updated 8 months ago
4import { Failure, Success } from "https://esm.town/v/pomdtr/neverthrow?v=5";
5
6const demoFunction = () => {
7 const result = Math.random();
8 if (result > 0.5) {
14};
15
16const res = demoFunction();
17if (res.ok) {
18 console.log(res.value);

neverthrowmain.tsx2 matches

@cofsana•Updated 8 months ago
9}
10
11export function Success<T>(value: T): Success<T> {
12 return { ok: true, value };
13}
14
15export function Failure<E>(error: E): Failure<E> {
16 return { ok: false, error };
17}

masterPancakeCheckermain.tsx3 matches

@bpugh•Updated 8 months ago
9const STORAGE_KEY = "alamo_showings";
10
11async function fetchShowings() {
12 const response = await fetch(THEATER_API);
13 return await response.json();
14}
15
16async function compareAndNotify(newShowings) {
17 const oldShowings = await blob.getJSON(STORAGE_KEY).catch(() => ({})) || {};
18 const newMovies = newShowings.data.presentations.filter(presentation => !oldShowings[presentation.slug]);
36}
37
38export default async function main() {
39 const showings = await fetchShowings();
40 await compareAndNotify(showings);

AlgoliaRecordSender2main.tsx3 matches

@willthereader•Updated 8 months ago
407 "chapterTitle": "A Side Ws",
408 "chapterNumber": 1,
409 "content": "I believe they have the skills necessary to ensure all systems and networks function normally.\" Daedalus spoke up, saying, \"I can do that now.\" \"Transferring.\" With that, a small look of relief washed over the room. Heroes or not, they couldn't allow unrestricted access to an outside group. It wasn't simply a bad idea, it was also illegal. Dragon was a Protectorate member in practice, so they could let her handle things. Celestial Being on the other hand had none of the appropriate certifications to service a federal agency. Arresting Newtype for some federal charge now would be a nightmare, not that Kamil expected the girl to resist. \"I hope this makes the PRT reflect on things,\" Veda warned. \"I've spent most of the morning trying to fix damage inflicted on your networks by your own technicians in misguided attempts to sever my access.\" Seneca glanced around at the other monitors, scowling. \"Our apologies. Some staff must have become overly eager to protect our network security.\" \"I have begun purging all data gained through these accesses,\" Veda revealed. \"It would be improper to retain the information.\" \"We have no way to verify that,\" Banks accused. \"Then you will have to learn to live with it.\" While Seneca sent a silent warning to Banks, Kamil raised his brow. That was oddly assertive for StarGazer. He'd only spoken to her sparingly over the summer but she always seemed the timid one.",
410 "startIndex": 693,
411 "endIndex": 713,
657];
658
659// Function to add records to Algolia
660const addRecords = async () => {
661 const url = `https://${ALGOLIA_APP_ID}-dsn.algolia.net/1/indexes/${ALGOLIA_INDEX_NAME}/batch`;
694};
695
696// Serve function to handle the request and return the response
697export default async () => {
698 return await addRecords();

egoBoostermain.tsx3 matches

@stevekrouse•Updated 8 months ago
10import { marked } from "https://esm.sh/marked";
11
12function App() {
13 const [compliments, setCompliments] = useState<string>("");
14 const [isLoading, setIsLoading] = useState(false);
160}
161
162function client() {
163 console.log("Client-side rendering started");
164 createRoot(document.getElementById("root")!).render(<App />);
171}
172
173async function server(request: Request): Promise<Response> {
174 console.log("Server received request:", request.method, new URL(request.url).pathname);
175

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.