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=1691&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 20183 results for "function"(2839ms)

2// Titles are clickable and lead to a page with fake story content.
3
4export default async function(req: Request): Promise<Response> {
5 const url = new URL(req.url);
6 const pathname = url.pathname;
3// we can make it interactive with additional scripts.
4
5export default async function(req: Request): Promise<Response> {
6 const htmlContent = `
7<!DOCTYPE html>
3// we can make it interactive with additional scripts.
4
5export default async function(req: Request): Promise<Response> {
6 const htmlContent = `
7<!DOCTYPE html>
3// we can make it interactive with additional scripts.
4
5export default async function(req: Request): Promise<Response> {
6 const htmlContent = `
7<!DOCTYPE html>
3// we can make it interactive with additional scripts.
4
5export default async function(req: Request): Promise<Response> {
6 const htmlContent = `
7<!DOCTYPE html>
5 */
6
7export default async function(req: Request): Promise<Response> {
8 const htmlContent = `
9 <!DOCTYPE html>
4 */
5
6export default async function main(req: Request): Promise<Response> {
7 // Define some example stories
8 const stories = [
3// we can make it interactive with additional scripts.
4
5export default async function(req: Request): Promise<Response> {
6 const htmlContent = `
7<!DOCTYPE html>

btcmain.tsx9 matches

@park•Updated 10 months ago
9};
10
11async function getBitcoinData() {
12 try {
13 const [priceResponse, historyResponse] = await Promise.all([
34}
35
36function getChange(prices, times, daysAgo) {
37 const now = new Date().getTime();
38 const targetTime = now - daysAgo * 24 * 60 * 60 * 1000;
44}
45
46function calculateSMA(prices, period) {
47 return prices.slice(-period).reduce((sum, price) => sum + price, 0) / period;
48}
49
50function formatPrice(price) {
51 return Math.round(price).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
52}
53
54function daysBetween(date1, date2) {
55 const oneDay = 24 * 60 * 60 * 1000;
56 return Math.abs((date1 - date2) / oneDay);
57}
58
59function calculatePowerLawSupport(daysSinceGenesis) {
60 const logPrice = -17.35 + 5.836 * Math.log10(daysSinceGenesis);
61 return Math.pow(10, logPrice);
62}
63
64function generateSupportPrices(currentPrice) {
65 const genesisDate = new Date(2009, 0, 3);
66 const today = new Date();
81}
82
83function BitcoinData({ data }) {
84 if (!data) return <p>Failed to fetch Bitcoin data.</p>;
85
162}
163
164export default async function(req: Request) {
165 const bitcoinData = await getBitcoinData();
166

similarSitesmain.tsx2 matches

@qiangua•Updated 10 months ago
5const substrate = new Substrate({ apiKey: Deno.env.get("SUBSTRATE_API_KEY") });
6
7export default async function handler(req: Request): Promise<Response> {
8 const url = new URL(req.url).searchParams.get("url") || "https://thesephist.com/posts/synth/";
9 const searchResults = await exa.findSimilarAndContents(url, {
52 // Override the link renderer
53 const renderer = new marked.Renderer();
54 renderer.link = function(href, title, text) {
55 if (typeof href === 'object') {
56 text = href.text || text;

getFileEmail4 file matches

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

tuna8 file matches

@jxnblk•Updated 3 weeks 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.