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/$%7Bart_info.art.src%7D?q=function&page=2530&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 29356 results for "function"(5014ms)

htmlkitmain.tsx10 matches

@yawnxyz•Updated 9 months ago
8
9
10export async function getHtmlFromUrl(url) {
11 try {
12 const response = await fetch(url);
23
24// todo, pass in html optional, and skip fetch?
25export async function getMetadataFromUrl(url) {
26 const response = await fetch(url, {
27 method: "GET",
70
71
72// Function to remove unwanted selectors from the HTML and return the cleaned HTML
73export function removeSelectorsFromHtml(html, removeSelectors = "style, script, link, noscript, frame, iframe, comment") {
74 const $ = cheerio.load(html); // Load the HTML into Cheerio
75 $(removeSelectors).remove(); // Remove unwanted tags
80
81
82// Function to use Cheerio to select text from the html, and attempts to clean it a bit
83export function selectHtml(html, selector = "h1", removeSelectors = "style, script, link, noscript, frame, iframe, comment") {
84 const $ = cheerio.load(html); // Load the cleaned HTML into Cheerio
85 $(removeSelectors).remove(); // Remove unwanted tags
95}
96
97export async function convertHtml(html, option = "semantic") {
98 switch (option) {
99 case "markdown":
108}
109
110export async function convertHtmlToSemanticMarkdown(html, options = {}) {
111 const dom = new JSDOM(html);
112 return convertHtmlToMarkdown(html, {
126};
127
128// Function to convert HTML to Pug using html2pug
129export function convertHtmlToPug(html, options = { tabs: true }) {
130 const pug = html2pug(html, options);
131 return pug;

password_authmain.tsx5 matches

@sboesen•Updated 9 months ago
11};
12
13async function createSessionTable(tableName: string) {
14 await sqlite.execute(`CREATE TABLE ${tableName} (
15 id TEXT NOT NULL PRIMARY KEY,
19}
20
21async function createSession(tableName: string, valSlug: string): Promise<Session> {
22 try {
23 const expires_at = new Date();
39}
40
41async function getSession(tableName: string, sessionID: string, valSlug: string): Promise<Session> {
42 try {
43 const { rows, columns } = await sqlite.execute({
80</html>`;
81
82export function redirect(location: string): Response {
83 return new Response(null, {
84 headers: {
98const cookieName = "auth_session";
99
100export function passwordAuth(next, options?: PasswordAuthOptions) {
101 const sessionTable = options?.sessionTable || "password_auth_session";
102 return async (req: Request) => {

rainyAquamarineDonkeymain.tsx4 matches

@arthrod•Updated 9 months ago
27`;
28
29function RedBall() {
30 return <CentralDot />;
31}
32
33function App() {
34 return (
35 <div style={{ position: "relative", height: "100vh", width: "100vw" }}>
47}
48
49function client() {
50 const root = document.getElementById("root");
51 if (root) {
58if (typeof document !== "undefined") { client(); }
59
60export default async function server(request: Request): Promise<Response> {
61 return new Response(
62 `

codemirror_demomain.tsx1 match

@pomdtr•Updated 9 months ago
18`;
19
20export default function() {
21 return new Response(body, {
22 headers: {

nationalPeachPeacockmain.tsx1 match

@apppeak•Updated 9 months ago
12};
13
14export default async function(interval: Interval) {
15 const response = await notion.databases.query({
16 database_id: DATABASE_ID,

wetGrayQueleamain.tsx1 match

@apppeak•Updated 9 months ago
12};
13
14export default async function(interval: Interval) {
15 const response = await notion.databases.query({
16 database_id: DATABASE_ID,

dailyPeachSalmonmain.tsx1 match

@apppeak•Updated 9 months ago
12};
13
14export default async function(interval: Interval) {
15 const response = await notion.databases.query({
16 database_id: DATABASE_ID,

notionRecurringTasksmain.tsx1 match

@apppeak•Updated 9 months ago
12};
13
14export default async function(interval: Interval) {
15 const response = await notion.databases.query({
16 database_id: DATABASE_ID,

redBallComponentmain.tsx2 matches

@arthrod•Updated 9 months ago
19`;
20
21export default async function server(request: Request): Promise<Response> {
22 return new Response(
23 `
44 <div id="root"></div>
45 <script type="text/babel">
46 function RedBall() {
47 return (
48 <div

merchantAnalysisPromptmain.tsx1 match

@mjweaver01•Updated 9 months ago
18
19- pie: Syntax Drawing a pie chart is really simple in mermaid. Start with pie keyword to begin the diagram showData to render the actual data values after the legend text. This is OPTIONAL Followed by title keyword and its value in string to give a title to the pie-chart. This is OPTIONAL Followed by dataSet. Pie slices will be ordered clockwise in the same order as the labels. label for a section in the pie diagram within " " quotes. Followed by : colon as separator Followed by positive numeric value (supported up to two decimal places) [pie] [showData] (OPTIONAL) [title] [titlevalue] (OPTIONAL) "[datakey1]" : [dataValue1] "[datakey2]" : [dataValue2] "[datakey3]" : [dataValue3]
20- xychart-beta: Syntax INFO All text values that contain only one word can be written without ". If a text value has many words in it, specifically if it contains spaces, enclose the value in " Orientations The chart can be drawn horizontal or vertical, default value is vertical. xychart-beta horizontal ... Title The title is a short description of the chart and it will always render on top of the chart. Example xychart-beta title "This is a simple example" ... INFO If the title is a single word one no need to use ", but if it has space " is needed x-axis The x-axis primarily serves as a categorical value, although it can also function as a numeric range value when needed. Example x-axis title min --> max x-axis will function as numeric with the given range x-axis "title with space" [cat1, "cat2 with space", cat3] x-axis if categorical, categories are text type y-axis The y-axis is employed to represent numerical range values, it cannot have categorical values. Example y-axis title min --> max y-axis title it will only add the title, the range will be auto generated from data. INFO Both x and y axis are optional if not provided we will try to create the range Line chart A line chart offers the capability to graphically depict lines. Example line [2.3, 45, .98, -3.4] it can have all valid numeric values. Bar chart A bar chart offers the capability to graphically depict bars. Example bar [2.3, 45, .98, -3.4] it can have all valid numeric values. Simplest example The only two things required are the chart name (xychart-beta) and one data set. So you will be able to draw a chart with a simple config like xychart-beta line [+1.3, .6, 2.4, -.34]
21
22Some good examples for mermaid charts are:
tuna

tuna9 file matches

@jxnblk•Updated 2 days ago
Simple functional CSS library for Val Town

getFileEmail4 file matches

@shouser•Updated 1 month ago
A helper function to build a file's email
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.