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=2453&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 28712 results for "function"(3993ms)

CaptchaGetBalancemain.tsx1 match

@augustohp•Updated 8 months ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export default async function fetchBalanceFromCaptchaProvider(
4 token: string,
5 provider: "capmonster" | "anticaptcha" | "nextcaptcha",

v3FanFicScrapermain.tsx7 matches

@willthereader•Updated 8 months ago
5console.log("Script started");
6
7function App() {
8 const [url, setUrl] = useState("");
9 const [scrapedData, setScrapedData] = useState("");
56}
57
58function client() {
59 console.log("Client function called");
60 const rootElement = document.getElementById("root");
61 if (rootElement) {
67
68if (typeof document !== "undefined") {
69 console.log("Document is defined, calling client function");
70 client();
71} else {
72 console.log("Document is undefined, skipping client function");
73}
74
75async function server(request: Request): Promise<Response> {
76 console.log("Server function called");
77
78 if (request.method === "POST" && new URL(request.url).pathname === "/scrape") {

XKCDComicOfTheDaymain.tsx1 match

@wolf•Updated 8 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);

megacloudUtilsmain.tsx5 matches

@temptemp•Updated 8 months ago
1import CryptoJS from "npm:crypto-js";
2const cryptoJs = CryptoJS;
3function _kv(a) {
4 return [(a & 4278190080) >> 24, (a & 16711680) >> 16, (a & 65280) >> 8, a & 255];
5}
13 }
14};
15export async function decryptURL(a, X) {
16 try {
17 var r0 = CryptoJS.AES.decrypt(a, X);
23}
24
25export async function decryptSource(keys, kversion, response) {
26 let encrypted = response.sources;
27 console.log(kversion);
38 return response;
39}
40export async function getMeta(id) {
41 const req = await fetch(`https://rabbitstream.net/v2/embed-4/${id}?z=`, {
42 headers: {
54 return metaMatch[1];
55}
56export async function getWasm() {
57 const req = await fetch("https://rabbitstream.net/images/loading.png?v=0.6", {
58 "headers": {

githubreposearchmain.tsx1 match

@toowired•Updated 8 months ago
1export default async function fetchNewPublicGitHubRepos() {
2 // Generate today's date in YYYY-MM-DD format
3 const today = new Date().toISOString().split("T")[0];

mosaiclipsemain.tsx4 matches

@moe•Updated 8 months ago
36let colorPalette: any
37
38export function setup() {
39 tileCount = Math.floor(random(5, 9))
40 tileSize = canvasSize / tileCount
45}
46
47export function draw() {
48 let colorindex = Math.floor(random(colorPalette.length))
49 background(colorPalette[colorindex % colorPalette.length])
70}
71
72export function keyPressed() {
73 if (key == "i") {
74 saveCanvas("p5js-" + new Date().getTime(), "png")
78 }
79}
80// export function touchEnded() {
81// saveCanvas("p5js-" + new Date().getTime(), "png");
82// }

computeScheduleREADME.md1 match

@toowired•Updated 8 months ago
1# `computeSchedule` function
2Combines several schedule segments together to form a complete schedule for a 24-hour period.
3

statusmain.tsx4 matches

@overengineered•Updated 8 months ago
4import { render } from "npm:preact-render-to-string";
5
6export const sha256 = async function digestMessage(message) {
7 const msgUint8 = new TextEncoder().encode(message); // encode as (utf-8) Uint8Array
8 const hashBuffer = await crypto.subtle.digest("SHA-256", msgUint8); // hash the message
18);
19
20function BasicLayout(props) {
21 return (
22 <html>
33}
34
35export default async function(req: Request): Promise<Response> {
36 const url = new URL(req.url);
37 if (req.method === "POST") {
94 {` var cookies = document.getElementById('cookies');
95 var login = document.getElementById('login');
96 cookies.onchange = function () {
97 login.disabled = false;//!this.checked;
98 }`}

lightGrayCrowmain.tsx4 matches

@jeffreyyoung•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

@jeffreyyoung•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 month ago
A helper function to build a file's email
tuna

tuna8 file matches

@jxnblk•Updated 1 month ago
Simple functional CSS library for Val Town
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.