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=756&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 7804 results for "function"(6605ms)

cerebras_debatermain.tsx3 matches

@stevekrouse•Updated 6 months ago
16];
17
18function App() {
19 const [personality1, setPersonality1] = useState("an emacs enthusiast");
20 const [personality2, setPersonality2] = useState("a vim enthusiast");
205}
206
207function client() {
208 createRoot(document.getElementById("root")).render(<App />);
209}
213}
214
215export default async function server(req: Request): Promise<Response> {
216 const url = new URL(req.url);
217

intellectualMaroonMockingbirdmain.tsx5 matches

@stevekrouse•Updated 6 months ago
6import { tomorrow } from "https://esm.sh/react-syntax-highlighter/dist/esm/styles/prism";
7
8function App() {
9 const [prompt, setPrompt] = useState("hello llamapalooza");
10 const [code, setCode] = useState("");
20 >(null);
21
22 async function handleSubmit(e: React.FormEvent) {
23 e.preventDefault();
24 setLoading(true);
131}
132
133function client() {
134 createRoot(document.getElementById("root")!).render(<App />);
135}
139}
140
141function extractCodeFromFence(text: string): string {
142 const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
143 return htmlMatch ? htmlMatch[1].trim() : text;
144}
145
146export default async function server(req: Request): Promise<Response> {
147 if (req.method === "POST") {
148 const client = new Cerebras();

truthfulAmethystParakeetmain.tsx5 matches

@stevekrouse•Updated 6 months ago
6import { tomorrow } from "https://esm.sh/react-syntax-highlighter/dist/esm/styles/prism";
7
8function App() {
9 const [prompt, setPrompt] = useState("hello llamapalooza");
10 const [code, setCode] = useState("");
20 >(null);
21
22 async function handleSubmit(e: React.FormEvent) {
23 e.preventDefault();
24 setLoading(true);
123}
124
125function client() {
126 createRoot(document.getElementById("root")!).render(<App />);
127}
131}
132
133function extractCodeFromFence(text: string): string {
134 const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
135 return htmlMatch ? htmlMatch[1].trim() : text;
136}
137
138export default async function server(req: Request): Promise<Response> {
139 if (req.method === "POST") {
140 const client = new Cerebras();

welcomingSapphireRoundwormmain.tsx3 matches

@stevekrouse•Updated 6 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const [query, setQuery] = useState("");
7 const [searchLoading, setSearchLoading] = useState(false);
109}
110
111function client() {
112 createRoot(document.getElementById("root")).render(<App />);
113}
117}
118
119export default async function server(req: Request): Promise<Response> {
120 if (req.method === "POST") {
121 const url = new URL(req.url);

passwordgamemain.tsx10 matches

@stevekrouse•Updated 6 months ago
9}
10
11function App() {
12 const [password, setPassword] = useState("");
13 const [level, setLevel] = useState(1);
34 try {
35 // eslint-disable-next-line no-new-func
36 const isValid = new Function("password", `return ${requirement.validator}`)(password);
37 if (!isValid) {
38 failed.push(JSON.stringify(requirement));
139}
140
141function client() {
142 createRoot(document.getElementById("root")!).render(<App />);
143}
147}
148
149export default async function server(req: Request): Promise<Response> {
150 if (req.method === "POST") {
151 const client = new Cerebras();
173 model: "llama3.1-70b",
174 tools: [{
175 type: "function",
176 function: {
177 name: "generateRequirement",
178 description: `Generate a creative password requirement with two fields:
224 });
225
226 const functionCall = completion.choices?.at(0)?.message?.tool_calls?.at(0)?.function;
227 if (functionCall?.name === "generateRequirement") {
228 return new Response(functionCall.arguments, {
229 headers: { "Content-Type": "application/json" },
230 });
231 } else {
232 console.log(completion);
233 throw new Error("Unexpected function call");
234 }
235 }

pluckyGreenHyenamain.tsx4 matches

@stevekrouse•Updated 6 months ago
4import { createRoot } from "https://esm.sh/react-dom/client";
5
6function App() {
7 const [messages, setMessages] = useState([]);
8 const [apiKey, setApiKey] = useState("");
28 };
29
30 async function handleSubmit(e) {
31 e.preventDefault();
32 const newMessage = e.target.message.value;
160}
161
162function client() {
163 createRoot(document.getElementById("root")).render(<App />);
164}
166if (typeof document !== "undefined") { client(); }
167
168export default async function server(request: Request): Promise<Response> {
169 return new Response(
170 `<!DOCTYPE html>

phpmain.tsx1 match

@maxm•Updated 6 months ago
2const php = new PhpWeb();
3
4export default async function(req: Request): Promise<Response> {
5 let logs: any[] = [];
6 php.addEventListener("output", (event: any) => logs.push(...event.detail));

chatWithCerebrasmain.tsx1 match

@stevekrouse•Updated 6 months ago
1import Cerebras from "https://esm.sh/@cerebras/cerebras_cloud_sdk";
2
3export default async function server(request: Request): Promise<Response> {
4 const url = new URL(request.url);
5 const formData = new URLSearchParams(url.search);

newUserWelcomeEmailmain.tsx2 matches

@charmaine•Updated 6 months ago
4import { html } from "https://esm.town/v/stevekrouse/html";
5
6async function sendTownieEmail() {
7 try {
8 await email({
19}
20
21export async function newUserWelcomeEmail(req: Request): Promise<Response> {
22 if (req.method === "GET") return html(welcomeEmail);
23 if (req.headers.get("clerkNonSensitive") !== Deno.env.get("clerkNonSensitive"))

runescapeWoodCuttingmain.tsx4 matches

@charmaine•Updated 6 months ago
9};
10
11function LoginScreen({ onLogin }) {
12 const [name, setName] = useState("");
13
36}
37
38function App() {
39 const [playerName, setPlayerName] = useState("");
40 const [skill, setSkill] = useState("woodcutting");
107}
108
109function client() {
110 createRoot(document.getElementById("root")).render(<App />);
111}
115}
116
117export default async function server(request: Request): Promise<Response> {
118 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
119 const SCHEMA_VERSION = 2;

getFileEmail4 file matches

@shouser•Updated 6 days ago
A helper function to build a file's email

TwilioHelperFunctions

@vawogbemi•Updated 2 months ago