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=753&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 7802 results for "function"(590ms)

firehosemain.tsx3 matches

@stevekrouse•Updated 5 months ago
9const agent = new AtpAgent({ service });
10
11function App() {
12 const [messages, setMessages] = useState([]);
13 const [isActive, setIsActive] = useState(true);
213}
214
215function client() {
216 createRoot(document.getElementById("root")).render(<App />);
217}
221}
222
223export default async function server(request: Request): Promise<Response> {
224 return new Response(
225 `

chatgptchessmain.tsx4 matches

@tmcw•Updated 5 months ago
42 let game = new Chess(position)
43
44 function onDragStart(source, piece, position, orientation) {
45 // do not pick up pieces if the game is over
46 if (game.isGameOver()) return false
55 }
56
57 function onDrop(source: string, target: string) {
58 // see if the move is legal
59 try {
86 // update the board position after the piece snap
87 // for castling, en passant, pawn promotion
88 function onSnapEnd() {
89 board.position(game.fen())
90 }
91
92 function updateStatus() {
93 var status = ""
94

dns_record_debuggermain.tsx3 matches

@stevekrouse•Updated 5 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const [url, setUrl] = useState("");
7 const [content, setContent] = useState("");
51}
52
53function client() {
54 createRoot(document.getElementById("root")).render(<App />);
55}
59}
60
61export default async function server(request: Request): Promise<Response> {
62 const { fetch } = await import("https://esm.town/v/std/fetch");
63

yc_findermain.tsx5 matches

@stevekrouse•Updated 5 months ago
23`;
24
25function Hero() {
26 return (
27 <div className="hero">
32}
33
34function HowItWorks() {
35 return (
36 <div className="how-it-works">
53}
54
55function App() {
56 const [ycCompanies, setYcCompanies] = useState<YCCompany[]>([]);
57 const [mergedData, setMergedData] = useState<any[]>([]);
217}
218
219function client() {
220 createRoot(document.getElementById("root")!).render(<App />);
221}
225}
226
227export default async function server(request: Request): Promise<Response> {
228 const companies = await fetch("https://stevekrouse-yc_database.web.val.run").then(res => res.json());
229 const url = new URL(request.url);

passionateScarletPrawnmain.tsx3 matches

@stevekrouse•Updated 5 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const [prompt, setPrompt] = useState("");
7 const [useProModel, setUseProModel] = useState(false);
77}
78
79function client() {
80 createRoot(document.getElementById("root")).render(<App />);
81}
85}
86
87export default async function server(request: Request): Promise<Response> {
88 if (request.method === "GET") {
89 return new Response(

laudableFuchsiaMastodonmain.tsx3 matches

@stevekrouse•Updated 5 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const [prompt, setPrompt] = useState("");
7 const [useProModel, setUseProModel] = useState(false);
72}
73
74function client() {
75 createRoot(document.getElementById("root")).render(<App />);
76}
80}
81
82export default async function server(request: Request): Promise<Response> {
83 if (request.method === "POST") {
84 const { prompt, useProModel } = await request.json();

shirtGenScriptmain.tsx1 match

@stevekrouse•Updated 5 months ago
1export default async function server(request: Request): Promise<Response> {
2 if (request.method !== "POST") {
3 return new Response("Method Not Allowed", { status: 405 });

xmasRedHamstermain.tsx2 matches

@stevekrouse•Updated 5 months ago
1export default async function (req: Request): Promise<Response> {
2 const url = new URL(req.url);
3 const query = url.searchParams.get("q");
26}
27
28async function getMostPopularPinterestImage(query: string): Promise<string> {
29 const searchUrl = `https://api.pinterest.com/v5/search/pins?query=${encodeURIComponent(query)}&page_size=50&sort_order=popularity`;
30 const response = await fetch(searchUrl, {

generateframeImagemain.tsx5 matches

@stevekrouse•Updated 5 months ago
3import { renderToString } from "https://esm.sh/react-dom/server";
4
5async function getWeather(latitude: number, longitude: number) {
6 const url =
7 `https://api.open-meteo.com/v1/forecast?latitude=${latitude}&longitude=${longitude}&current_weather=true&temperature_unit=fahrenheit`;
20}
21
22function getWeatherCondition(code: number): string {
23 const conditions: { [key: number]: string } = {
24 0: "Clear sky",
42}
43
44function WeatherDisplay({ weather }: { weather: any }) {
45 const currentDate = new Date().toLocaleDateString("en-US", {
46 timeZone: "America/Los_Angeles",
142}
143
144async function generateImage(html: string): Promise<Response> {
145 const apiKey = Deno.env.get("API_FLASH_KEY");
146 const encodedHtml = encodeURIComponent(html);
160}
161
162export default async function(req: Request) {
163 const url = new URL(req.url);
164 const isImageRequest = url.searchParams.get("generate") === "image";

simpleWikipediaInstantSearchmain.tsx2 matches

@maxm•Updated 5 months ago
166 });
167
168 async function fetchResults(query) {
169 try {
170 const response = await fetch(\`/search?q=\${encodeURIComponent(query)}\`);
176 }
177
178 function displayResults(results) {
179 searchResults.innerHTML = '';
180 if (results.length > 0) {

getFileEmail4 file matches

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

TwilioHelperFunctions

@vawogbemi•Updated 2 months ago