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=759&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"(459ms)

XKCDComicOfTheDaymain.tsx1 match

@wolf•Updated 7 months ago
2import { load } from "npm:cheerio";
3
4export default async function(req: Request): Promise<Response> {
5 const response = await fetchText("https://xkcd.com/");
6 const $ = load(response);

whoIsHiringmain.tsx3 matches

@stevekrouse•Updated 7 months ago
7import About from "https://esm.town/v/vawogbemi/whoIsHiringAbout";
8
9function App() {
10 const tabs = { "/": "Home", "/about": "About" };
11 const [activeTab, setActiveTab] = useState("/");
335}
336
337function ServerApp() {
338 return (
339 <html>
358}
359
360export default async function(req: Request): Promise<Response> {
361 const url = new URL(req.url);
362 if (url.pathname === "/api/stories") {

satisfactoryBlushCatsharkmain.tsx2 matches

@maxm•Updated 7 months ago
2import { base58 } from "npm:@scure/base";
3
4export function convertUUIDToToken(uuid: string): string {
5 return "vt_" + base58.encode(Buffer.from(uuid.replace(/-/g, ""), "hex"));
6}
7
8export function generateAndConvertUUIDs() {
9 const uuidBuffer = Buffer.alloc(16);
10 let tokenLength = 0;

pasetomain.tsx1 match

@maxm•Updated 7 months ago
6// console.log(await V4.generateKey("public", { format: "keyobject" }));
7
8function uuidToHex(uuid: string): string {
9 // Remove hyphens from the UUID
10 const cleanUuid = uuid.replace(/-/g, "");

dateme_browsemain.tsx4 matches

@stevekrouse•Updated 7 months ago
5import { zip } from "npm:lodash-es";
6
7function absoluteURL(url) {
8 if (url.startsWith("http://") || url.startsWith("https://"))
9 return url;
25let linkClass = "text-sky-600 hover:text-sky-500";
26
27function httpsIfy(url: string) {
28 if (!url.startsWith("http://") && !url.startsWith("https://")) {
29 return `https://${url}`;
32}
33
34function renderCell(header, row) {
35 let data = row[header];
36 if (header === "Name") {
46}
47
48export default async function Browse(c) {
49 const url = new URL(c.req.url);
50 const search = {

cronJobToCheckCISAKEVmain.tsx2 matches

@hrbrmstr•Updated 7 months ago
5const BLOB_KEY = "seen_cves";
6
7async function checkNewVulnerabilities() {
8 const response = await fetch(KEV_URL);
9 const data = await response.json();
30}
31
32export default async function kevCron() {
33 return await checkNewVulnerabilities();
34}

knownExploitedVulnsEndpointmain.tsx1 match

@hrbrmstr•Updated 7 months ago
1export default async function server(request: Request): Promise<Response> {
2 try {
3 const response = await fetch("https://www.cisa.gov/sites/default/files/feeds/known_exploited_vulnerabilities.json");

cisaKEVToRSSmain.tsx4 matches

@hrbrmstr•Updated 7 months ago
3const RSS_FEED_URL = "https://hrbrmstr-cisakevtorss.web.val.run"; // Update this to your actual RSS feed URL
4
5function escapeXML(str: string): string {
6 return str.replace(/&/g, "&amp;")
7 .replace(/</g, "&lt;")
11}
12
13function removeInvalidXMLChars(str: string): string {
14 return str
15 .replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g, "") // Control characters
19}
20
21function generateRSS(data: any): string {
22 const { title, catalogVersion, dateReleased, vulnerabilities } = data;
23
68}
69
70export async function handler(req: Request): Promise<Response> {
71 try {
72 const response = await fetch(CISA_JSON_URL);

valWallmain.tsx6 matches

@stevekrouse•Updated 7 months ago
62});
63
64async function generateGraph(username, useVersions = true) {
65 if (!username) {
66 return html`<p class="text-red-500">Please enter a username</p>`;
104}
105
106function renderPage(c, initialUsername = null) {
107 return c.html(html`
108 <!DOCTYPE html>
164 `);
165}
166function generateMonthLabels(contributionData) {
167 const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
168 const today = dayjs();
202}
203
204function generateContributionRows(contributionData) {
205 const dayLabels = ["", "Mon", "", "Wed", "", "Fri", ""];
206 let rows = [];
217 return rows;
218}
219function generateContributionCells(contributionData, dayOfWeek) {
220 let cells = [];
221 for (let i = dayOfWeek; i < contributionData.length; i += 7) {
240 return cells;
241}
242function processVals(vals, useVersions) {
243 const today = new Date();
244 const oneYearAgo = new Date(today.getFullYear() - 1, today.getMonth(), today.getDate());

emailAddForwardedInfomain.tsx2 matches

@maxm•Updated 7 months ago
14
15// Sat, Aug 17, 2024 at 10:42
16function formatDate(date) {
17 const options = {
18 weekday: "short",
29}
30
31export default function emailAddForwardedInfo(e: Email): Email {
32 const [to, cc, bcc, from] = [e.to, e.cc, e.cc, e.from].map(parse);
33 if (e.html) {

getFileEmail4 file matches

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

TwilioHelperFunctions

@vawogbemi•Updated 2 months ago