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=903&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 10292 results for "function"(482ms)

stormyCyanLeoponmain.tsx1 match

@stevekrouse•Updated 8 months ago
6 webhook_url: string = process.env.discord_webhook,
7) => {
8 function chunkString(str) {
9 const chunks = [];
10 let startIndex = 0;

stormyCyanLeoponREADME.md3 matches

@stevekrouse•Updated 8 months ago
1# Send Chunked Discord Message
2This function is used to send a message to a Discord webhook. If the message exceeds the maximum character limit (2000 characters), it will be divided into chunks and sent as multiple messages.
3
4### Parameters
5message (string): The message to be sent to the Discord webhook.
6### Return Value
7This function does not return any value.
8
9## Example Usage:
13await @ktodaz.sendDiscordMessage(message);
14```
15In the above example, the sendDiscordMessage function is used to send the message to the Discord webhook. If the message exceeds 2000 characters, it will be split into smaller chunks and sent as separate messages.
16
17## Required Secrets:

sendDiscordMessageREADME.md3 matches

@stevekrouse•Updated 8 months ago
1# Send Chunked Discord Message
2This function is used to send a message to a Discord webhook. If the message exceeds the maximum character limit (2000 characters), it will be divided into chunks and sent as multiple messages.
3
4### Parameters
5message (string): The message to be sent to the Discord webhook.
6### Return Value
7This function does not return any value.
8
9## Example Usage:
13await @ktodaz.sendDiscordMessage(message);
14```
15In the above example, the sendDiscordMessage function is used to send the message to the Discord webhook. If the message exceeds 2000 characters, it will be split into smaller chunks and sent as separate messages.
16
17## Required Secrets:

sendDiscordMessagemain.tsx1 match

@stevekrouse•Updated 8 months ago
6 webhook_url: string = process.env.discord_webhook,
7) => {
8 function chunkString(str) {
9 const chunks = [];
10 let startIndex = 0;

caniuse_notifiermain.tsx2 matches

@stevekrouse•Updated 8 months ago
7const dataKey = "caniuse-data";
8
9function Feature({ feature }: any) {
10 const links = feature.links ?? [];
11 return (
27}
28
29export default async function(interval: Interval) {
30 const previousDataUpdatedAt = await blob.getJSON(updatedKey) ?? 0;
31 const previousData = await blob.getJSON(dataKey);

clickTrackerWebsitemain.tsx3 matches

@ankitkr0•Updated 8 months ago
7import confetti from 'https://esm.sh/canvas-confetti';
8
9function App() {
10 const [clicks, setClicks] = useState(0);
11
49}
50
51function client() {
52 createRoot(document.getElementById("root")).render(<App />);
53}
55if (typeof document !== "undefined") { client(); }
56
57async function server(request: Request): Promise<Response> {
58 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
59 const SCHEMA_VERSION = 2

hackerNewsDigestmain.tsx4 matches

@parkerdavis•Updated 8 months ago
3import { email } from "https://esm.town/v/std/email";
4
5async function fetchStories(type: string, count: number) {
6 const response = await fetch(`https://hacker-news.firebaseio.com/v0/${type}stories.json`);
7 const storyIds = await response.json();
15}
16
17function createStoryHTML(story: any) {
18 return `
19 <li>
28}
29
30function createEmailContent(
31 topStories: any[],
32 newStories: any[],
118}
119
120export default async function server(req: Request) {
121 try {
122 const topStories = await fetchStories("top", 10);

infoboxCrawlermain.tsx7 matches

@stevekrouse•Updated 8 months ago
10const TITLE_SELECTOR = "#firstHeading > span";
11
12function labelPredicate(label) {
13 return label === "Father" || label === "Mother" || /^Parent/.test(label) || label === "Children" || /^Child/.test(label);
14}
15
16async function* crawlWikipedia(
17 url: string,
18 generation: number = 0,
60}
61
62function App() {
63 const [url, setUrl] = useState("");
64 const [nodes, setNodes] = useState([]);
148 });
149
150 cyRef.current.on("tap", "node", function(evt) {
151 if (isCytoscapeDisabled) return;
152 const node = evt.target;
154 });
155
156 cyRef.current.on("layoutstop", function() {
157 cyRef.current.center();
158 cyRef.current.fit();
255}
256
257function client() {
258 createRoot(document.getElementById("root")).render(<App />);
259}
263}
264
265async function server(req: Request): Promise<Response> {
266 const url = new URL(req.url);
267

hackerNewsDigestmain.tsx4 matches

@roramigator•Updated 8 months ago
3import { email } from "https://esm.town/v/std/email";
4
5async function fetchStories(type: string, count: number) {
6 const response = await fetch(`https://hacker-news.firebaseio.com/v0/${type}stories.json`);
7 const storyIds = await response.json();
15}
16
17function createStoryHTML(story: any) {
18 return `
19 <li>
28}
29
30function createEmailContent(
31 topStories: any[],
32 newStories: any[],
118}
119
120export default async function server(req: Request) {
121 try {
122 const topStories = await fetchStories("top", 10);

hackerNewsDigestmain.tsx4 matches

@stevekrouse•Updated 8 months ago
3import { email } from "https://esm.town/v/std/email";
4
5async function fetchStories(type: string, count: number) {
6 const response = await fetch(`https://hacker-news.firebaseio.com/v0/${type}stories.json`);
7 const storyIds = await response.json();
15}
16
17function createStoryHTML(story: any) {
18 return `
19 <li>
28}
29
30function createEmailContent(
31 topStories: any[],
32 newStories: any[],
118}
119
120export default async function server(req: Request) {
121 try {
122 const topStories = await fetchStories("top", 10);

getFileEmail4 file matches

@shouser•Updated 1 week ago
A helper function to build a file's email

TwilioHelperFunctions

@vawogbemi•Updated 2 months ago