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=1319&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 17277 results for "function"(1995ms)

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) {

primewiremain.tsx4 matches

@tempdev•Updated 7 months ago
7} from "https://raw.githubusercontent.com/Ciarands/mw-providers/dev/src/providers/sources/primewire/common.ts";
8
9async function search(imdbId: string) {
10 const searchResult = await fetch(`${primewireBase}/api/v1/show?key=${primewireApiKey}&imdb_id=${imdbId}`);
11 return await searchResult.json().then((searchResult) => {
14}
15
16async function getStreams(title: string) {
17 const titlePage = load(title);
18 const userData = titlePage("#user-data").attr("v");
53}
54
55export async function scrapeMovie(imdbId) {
56 const searchResult = await search(imdbId);
57
64 };
65}
66export async function scrapeShow(imdbId, seasonId, episodeId) {
67 console.log(imdbId, seasonId, episodeId);
68 if (!imdbId) throw new Error("No imdbId provided");

threeJsTorusmain.tsx6 matches

@yawnxyz•Updated 7 months ago
2// The scene is rendered client-side using WebGL.
3
4export default async function server(request: Request): Promise<Response> {
5 const html = `
6 <!DOCTYPE html>
92 let previousMousePosition = { x: 0, y: 0 };
93
94 function animate() {
95 requestAnimationFrame(animate);
96
138 window.addEventListener('resize', onWindowResize, false);
139
140 function onWindowResize() {
141 camera.aspect = window.innerWidth / window.innerHeight;
142 camera.updateProjectionMatrix();
149 document.addEventListener('mouseup', onMouseUp, false);
150
151 function onMouseDown(event) {
152 isDragging = true;
153 previousMousePosition = {
157 }
158
159 function onMouseMove(event) {
160 if (!isDragging) return;
161
171 }
172
173 function onMouseUp(event) {
174 isDragging = false;
175 }

healthdatasimplemain.tsx3 matches

@ejfox•Updated 7 months ago
7
8// Client-side App component
9function App({ data }) {
10 return (
11 <div>
38
39// Client-side rendering
40function client() {
41 fetch('/api/health-data')
42 .then(response => response.json())
50}
51
52export default async function server(request: Request): Promise<Response> {
53 const { blob } = await import("https://esm.town/v/std/blob");
54

redditSearchmain.tsx4 matches

@stevekrouse•Updated 7 months ago
15
16// Use Browserbase (with proxy) to search and scrape Reddit results
17export async function redditSearch({
18 query,
19 apiKey = Deno.env.get("BROWSERBASE_API_KEY"),
46}
47
48function constructSearchUrl(query: string): string {
49 const encodedQuery = encodeURIComponent(query).replace(/%20/g, "+");
50 return `https://www.reddit.com/search/?q=${encodedQuery}&type=link&t=week`;
51}
52
53async function extractPostData(page: any): Promise<Partial<ThreadResult>[]> {
54 return page.evaluate(() => {
55 const posts = document.querySelectorAll("div[data-testid=\"search-post-unit\"]");
67}
68
69async function processPostData(postData: Partial<ThreadResult>[]): Promise<ThreadResult[]> {
70 const processedData: ThreadResult[] = [];
71

handlermain.tsx4 matches

@tempdev•Updated 7 months ago
15 year: number;
16}
17async function movieHandler(meta: Meta) {
18 const data = await scrapeMovie(meta.imdb_id);
19 let htmlData = "";
37 `;
38}
39async function showHandler(meta: Meta, s, e) {
40 const data = await scrapeShow(meta.imdb_id, s, e);
41 let htmlData = "";
59 `;
60}
61async function getMeta(imdbId: string): Promise<Meta> {
62 const searchResult = await fetch(`${primewireBase}/api/v1/show?key=${primewireApiKey}&imdb_id=${imdbId}`);
63 return await searchResult.json() as Meta;
64}
65
66export async function handler(imdbId: string, season: number, episode: number) {
67 const meta: Meta = await getMeta(imdbId) as Meta;
68 switch (meta.type) {

starlightFakermain.tsx4 matches

@kylem•Updated 7 months ago
6import { faker } from "https://esm.sh/@faker-js/faker";
7
8function App() {
9 const [markdown, setMarkdown] = useState("");
10 const generateLoremIpsum = () => {
92 for (let i = 0; i < contentCount; i++) {
93 const randomComponent = components[Math.floor(Math.random() * (components.length - 1)) + 1];
94 if (typeof randomComponent === 'function') {
95 content += randomComponent();
96 }
180}
181
182function client() {
183 createRoot(document.getElementById("root")).render(<App />);
184}
301`;
302
303export default async function server(request: Request): Promise<Response> {
304 return new Response(`
305 <html>

srcbackendmain.tsx3 matches

@tempdev•Updated 7 months ago
20}
21
22export async function Fetcher(url: string, referer: string) {
23 const design = `?destination=${encodeURIComponent(url)}&referer=${encodeURIComponent(referer)}`;
24 const request = await fetch(`https://eb305cc8-973e-4f2d2-85dd-b1f16649c4d4.cloudflarepreviews.com/proxy${design}`, {
30 return request.text();
31}
32export async function doodstreamExtractor(id: string): Promise<DataSheet> {
33 const returnData: DataSheet = {
34 site: "dood",
56}
57// console.log(await doodstreamExtractor("9x3w3pu0xemy"));
58export async function streamtapeExtractor(id: string): Promise<DataSheet> {
59 console.log(id);
60 const returnData: DataSheet = {

FindFraudTrendsUsingGPTmain.tsx2 matches

@mjweaver01•Updated 7 months ago
66 });
67
68 function updateContent(newContent) {
69 fullContent += newContent;
70 const parsedContent = marked.parse(fullContent, {
82 }
83
84 function processMermaidCharts(newContent) {
85 if (typeof mermaid === 'undefined') {
86 setTimeout(processMermaidCharts, 100);

statusmain.tsx3 matches

@robincsl•Updated 7 months ago
5import { renderToString } from "npm:react-dom/server";
6
7function StatusRow({ rows }) {
8 return (
9 <div className="w-full flex flex-col space-y-2">
28}
29
30function StatusSection({ url, rows }) {
31 const sectionRows = rows.filter(row => row[0] === url);
32 const percentUp = Math.round((sectionRows.filter(row => row[1]).length / sectionRows.length) * 100);
44}
45
46export default async function(req: Request): Promise<Response> {
47 const { rows } = await sqlite.execute(
48 "select url, ok, duration, timestamp from uptime order by timestamp desc limit 200",

getFileEmail4 file matches

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

tuna8 file matches

@jxnblk•Updated 1 week ago
Simple functional CSS library for Val Town
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
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": "*",