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=2476&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 28846 results for "function"(2704ms)

QR_Generatormain.tsx3 matches

@muhammad_owais_warsi•Updated 8 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const [text, setText] = useState("");
7 const [qrCode, setQrCode] = useState("");
34}
35
36function client() {
37 createRoot(document.getElementById("root")).render(<App />);
38}
42}
43
44export default async function server(request: Request): Promise<Response> {
45 return new Response(
46 `

thisvalmain.tsx1 match

@begoon•Updated 8 months ago
6};
7
8function info(): ValInfo {
9 try {
10 throw new Error();

thisvalREADME.md2 matches

@begoon•Updated 8 months ago
1This val default exports a function returning ValInfo.
2
3The val information comes from the Deno stack trace induced by `throw new Error()`.
16import thisval from "https://esm.town/v/begoon/thisval";
17const val = thisval();
18export default async function(req: Request): Promise<Response> {
19 return Response.json(val);
20}

oddTanRoundwormmain.tsx1 match

@l2046a•Updated 8 months ago
1import { OpenAI } from "https://esm.town/v/std/openai";
2
3export default async function(req: Request): Promise<Response> {
4 if (req.method === "OPTIONS") {
5 return new Response(null, {

tonpickmain.tsx1 match

@cyrilos•Updated 8 months ago
13
14// handle incoming requests
15export default async function(req) {
16 const PLATFORM = "tonpick.game";
17 // const cookies = await blob.getJSON("platforms");

httpHelloWorldmain.tsx6 matches

@hugenshen•Updated 8 months ago
42];
43
44function MenuItem({ item }) {
45 const [isOpen, setIsOpen] = React.useState(false);
46 const [isHovered, setIsHovered] = React.useState(false);
68}
69
70function Menu() {
71 return (
72 <div style={{ width: "250px", borderRight: "1px solid #ccc", height: "100vh", overflowY: "auto" }}>
76}
77
78function Content() {
79 return (
80 <div style={{ padding: "20px", flexGrow: 1 }}>
97}
98
99function App() {
100 return (
101 <BrowserRouter>
108}
109
110function client() {
111 ReactDOM.createRoot(document.getElementById("root")).render(<App />);
112}
114if (typeof document !== "undefined") { client(); }
115
116async function server(request: Request): Promise<Response> {
117 return new Response(
118 `

tryingciceroagainmain.tsx5 matches

@arthrod•Updated 8 months ago
220`;
221
222function AnimatedHeadline() {
223 const [animationStarted, setAnimationStarted] = useState(false);
224 const [contentVisible, setContentVisible] = useState(false);
271`;
272
273function SubheadlineAnimation() {
274 const [animationStarted, setAnimationStarted] = useState(false);
275 const contentRef = useRef(null);
398`;
399
400function App() {
401 const [isNavOpen, setIsNavOpen] = React.useState(false);
402 const toggleNav = () => {
458}
459
460function client() {
461 createRoot(document.getElementById("root")).render(<App />);
462}
464if (typeof document !== "undefined") { client(); }
465
466export default async function server(request: Request): Promise<Response> {
467 return new Response(
468 `

scrapeCraigslistAPImain.tsx1 match

@rochambeau314•Updated 8 months ago
1import * as cheerio from "https://esm.sh/cheerio@1.0.0-rc.12";
2
3export default async function server(request: Request): Promise<Response> {
4 const url = new URL(request.url).searchParams.get("url");
5

imd_distrcitwise_warningsmain.tsx1 match

@thejeshgn•Updated 8 months ago
2// lalitpur up https://thejeshgn-imd_distrcitwise_warnings.web.val.run/?lat=24.6936599&lon=78.412621
3// vishisha MP https://thejeshgn-imd_distrcitwise_warnings.web.val.run/?lat=23.5210259&lon=77.809569
4export default async function(req: Request): Promise<Response> {
5 const url = new URL(req.url);
6 const lat = parseFloat(url.searchParams.get("lat") || "12.9796");

slackScoutmain.tsx10 matches

@pochetes•Updated 8 months ago
15}
16
17export default async function(interval: Interval): Promise<void> {
18 try {
19 await createTable();
38
39// Create an SQLite table
40async function createTable(): Promise<void> {
41 await sqlite.execute(`
42 CREATE TABLE IF NOT EXISTS ${TABLE_NAME} (
50
51// Fetch Hacker news, Twitter, and Reddit results
52async function fetchHackerNewsResults(topic: string): Promise<Website[]> {
53 return hackerNewsSearch({
54 query: topic,
58}
59
60async function fetchTwitterResults(topic: string): Promise<Website[]> {
61 return twitterSearch({
62 query: topic,
67}
68
69async function fetchRedditResults(topic: string): Promise<Website[]> {
70 return redditSearch({ query: topic });
71}
72
73function formatSlackMessage(website: Website): string {
74 const displayTitle = website.title || website.url;
75 return `*<${website.url}|${displayTitle}>*
78}
79
80async function sendSlackMessage(message: string): Promise<Response> {
81 const slackWebhookUrl = Deno.env.get("SLACK_WEBHOOK_URL");
82 if (!slackWebhookUrl) {
104}
105
106async function isURLInTable(url: string): Promise<boolean> {
107 const result = await sqlite.execute({
108 sql: `SELECT 1 FROM ${TABLE_NAME} WHERE url = :url LIMIT 1`,
112}
113
114async function addWebsiteToTable(website: Website): Promise<void> {
115 await sqlite.execute({
116 sql: `INSERT INTO ${TABLE_NAME} (source, url, title, date_published)
120}
121
122async function processResults(results: Website[]): Promise<void> {
123 for (const website of results) {
124 if (!(await isURLInTable(website.url))) {
tuna

tuna9 file matches

@jxnblk•Updated 6 hours ago
Simple functional CSS library for Val Town

getFileEmail4 file matches

@shouser•Updated 1 month ago
A helper function to build a file's email
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.