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/$%7Burl%7D?q=function&page=2383&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"(3477ms)

sanguineCyanMastodonREADME.md11 matches

@mikehiggins•Updated 6 months ago
22stopwords: Contains a list of common stop words and web-specific terms to filter out during text analysis.
23synonyms: Dictionary mapping common words to their synonyms for highlighting in TF-IDF analysis.
24Functions
25The primary functions perform specific text analysis tasks, as detailed in the following sections.
26
27Function Documentation
28Each function's purpose, parameters, and output are described below, along with notes on how they are used within the application.
29
30analyseSentiment(text)
72
73url (string): URL to fetch and clean content from. Returns: Cleaned text string or an error message.
74Usage: This function powers the URL input functionality.
75Core Functionalities
76Text Analysis Form (HTML)
77The form on the main page allows users to submit either raw text or a URL. The client-side JavaScript processes the form submission and, if needed, triggers a URL fetch to obtain content.
91
92Integration Tests: Ensure calculateTFIDF, calculateWordFrequency, and fetchUrlContent produce consistent outputs.
93Client-Side Testing: Regularly test URL fetching functionality to ensure robustness, particularly with dynamic sites.
94Error Handling
95
96Maintain try/catch blocks in asynchronous functions like fetchUrlContent to capture network issues.
97Update error messages to be user-friendly and provide feedback if inputs are invalid or exceed size limits.
98Data Sanitization
115Multilingual Support
116
117Extend stop words, sentiment analysis, and cleaning functions to support languages beyond English.
118
119The Radical Text Analyser code primarily uses the following APIs:
1232. External Content Fetching API (via fetch)
124 * Purpose: Retrieves HTML content from external URLs when users input a URL for analysis.
125 * Usage: The fetchUrlContent function uses fetch to make a GET request to the user-provided URL, which allows the application to process content from web pages.
126 * Error Handling: Includes logic to check response status and handle various network errors.
1273. Google Fonts API
132 * Usage: Loaded in the HTML <head> section with <script src="https://cdnjs.cloudflare.com/ajax/libs/jqcloud/1.0.4/jqcloud-1.0.4.min.js"></script> and <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqcloud/1.0.4/jqcloud.min.css">
133
134 The TF-IDF analysis in this code is performed without using an external library. Instead, it’s implemented directly in the `calculateTFIDF` function. Here’s how it works:
135
1361. **Tokenization and Filtering**: The text is split into words and phrases, excluding stopwords and web-specific terms.

twitterAlertmain.tsx1 match

@samwho•Updated 6 months ago
4const query = "\"samwho.dev\" -is:retweet -from:samwhoo";
5
6export async function twitterAlert({ lastRunAt }: Interval) {
7 // search
8 const since = lastRunAt ? Math.floor(lastRunAt.getTime() / 1000) : 0;

scraper_templateREADME.md1 match

@rickyfarm•Updated 6 months ago
133. Adjust the if statement to detect changes and update your blob
14
154. Craft a message to be sent with `sendNotification()` function

diplomaticMagentaMothmain.tsx3 matches

@maphido•Updated 6 months ago
6const SNAKE_SPEED = 100;
7
8function App() {
9 const canvasRef = useRef(null);
10 const [score, setScore] = useState(0);
189}
190
191function client() {
192 createRoot(document.getElementById("root")).render(<App />);
193}
195if (typeof document !== "undefined") { client(); }
196
197export default async function server(request: Request): Promise<Response> {
198 return new Response(`
199 <html>

labLoginUpdateStatusmain.tsx1 match

@todepond•Updated 6 months ago
3import { sqlite } from "https://esm.town/v/std/sqlite";
4
5export default async function(req: Request): Promise<Response> {
6 const TABLE_NAME = "lab_login_users_with_times";
7 const body = await req.json();

labLoginmain.tsx1 match

@todepond•Updated 6 months ago
3import { sqlite } from "https://esm.town/v/std/sqlite";
4
5export default async function(req: Request): Promise<Response> {
6 const body = await req.json();
7 let { username, password } = body;

basicAuthREADME.md2 matches

@a4v2d4•Updated 6 months ago
10import { basicAuth } from "https://esm.town/v/pomdtr/basicAuth";
11
12function handler(req: Request) {
13 return new Response("You are authenticated!");
14}
23import { verifyToken } from "https://www.val.town/v/pomdtr/verifyToken"
24
25function handler(req: Request) {
26 return new Response("You are authenticated!");
27}

basicAuthmain.tsx2 matches

@a4v2d4•Updated 6 months ago
1function extractCredentials(authorization) {
2 const parts = authorization.split(" ");
3 if (parts[0] != "Basic") {
11export type ServeHandler = (req: Request) => Response | Promise<Response>
12
13export function basicAuth(next: ServeHandler, params: {
14 verifyUser: (username: string, password: string) => boolean | Promise<boolean>;
15}): ServeHandler {

delightfulVioletAntlionmain.tsx1 match

@onetruechaos•Updated 6 months ago
8}
9
10export default async function server(request: Request): Promise<Response> {
11 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
12 const KEY = "delightfulVioletAntlion";

animalInfoIngpracticalBlushAlbatrossmain.tsx5 matches

@junhoca•Updated 6 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function StarRating({ rating, onRate }) {
6 return (
7 <div>
19}
20
21function DetailView({ item, type, onClose }) {
22 const [comments, setComments] = useState([]);
23 const [newComment, setNewComment] = useState('');
93}
94
95function App() {
96 const [page, setPage] = useState("clinics");
97 const [search, setSearch] = useState("");
288}
289
290function client() {
291 createRoot(document.getElementById("root")).render(<App />);
292}
293if (typeof document !== "undefined") { client(); }
294
295export default async function server(request: Request): Promise<Response> {
296 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
297 const SCHEMA_VERSION = 4

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.