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=1504&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 17310 results for "function"(2650ms)

sqliteExplorerApp_DEVREADME.md1 match

@nbbaier•Updated 1 year ago
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable
35- [x] add export to CSV, and JSON (CSV and JSON helper functions written in [this val](https://www.val.town/v/nbbaier/sqliteExportHelpers). Thanks to @pomdtr for merging the initial version!)
36- [x] add listener for cmd+enter to submit query
37

downloadScript_DEVmain.tsx2 matches

@nbbaier•Updated 1 year ago
8 const jsonBtn = document.getElementById("download-json");
9
10 function selectStatementFromPosition(statements, pos) {
11 for (const statement of statements) {
12 if (statement.end + 1 >= pos) return statement;
15 }
16
17 function getCode(): string {
18 // @ts-expect-error
19 const code = editor.code;

getCodeScriptmain.tsx3 matches

@nbbaier•Updated 1 year ago
1console.log("getCode() function loaded");
2import htmx from "https://esm.sh/htmx.org";
3import { identify } from "https://esm.sh/sql-query-identifier@2.7.0";
4
5if (typeof Deno === "undefined") {
6 function selectStatementFromPosition(statements, pos) {
7 for (const statement of statements) {
8 if (statement.end + 1 >= pos) return statement;
11 }
12
13 function getCode() {
14 const editor = htmx.find("#editordiv");
15 const code = editor.code;

enableButtonsScript_DEVmain.tsx2 matches

@nbbaier•Updated 1 year ago
9 const buttons = [csvBtn, jsonBtn, runBtn];
10
11 function checkForText() {
12 if (editor.view.state.doc.toString().trim() === "") {
13 buttons.forEach(btn => btn.disabled = true);
25 });
26
27 document.addEventListener("DOMContentLoaded", function() {
28 // Initial check
29 checkForText();

sqliteStudioSVGsmain.tsx3 matches

@nbbaier•Updated 1 year ago
3const iconSize = "1.125rem";
4
5export function RunSVG() {
6 return (
7 <svg
22}
23
24export function TableSVG() {
25 return (
26 <svg
41}
42
43export function ViewSVG() {
44 return (
45 <svg

codeOnValTownmain.tsx3 matches

@pomdtr•Updated 1 year ago
10 * @param val Define which val should open. Defaults to the root reference.
11 */
12export function modifyHtmlString(
13 bodyText: string,
14 { val, style }: { val?: ValRef; style?: string } = {},
41 * @param val Define which val should open
42 */
43export function modifyFetchHandler(
44 handler: (req: Request) => Response | Promise<Response>,
45 { val, style }: { val?: ValRef; style?: string } = {},
54
55export const honoMiddleware = (options: { val?: ValRef; style?: string } = {}): MiddlewareHandler => {
56 return async function(c, next) {
57 await next();
58 if (c.res.headers.get("Content-Type")?.startsWith("text/html")) {

codeOnValTownREADME.md1 match

@pomdtr•Updated 1 year ago
49### Linking to the val
50
51These functions infer the val using the call stack or the request URL. If the inference isn't working, or if you want to ensure it links to a specific val, pass the `val` argument:
52
53- `modifyFetchHandler(handler, {val: { handle: "andre", name: "foo" }})`

react_example_clientmain.tsx2 matches

@pomdtr•Updated 1 year ago
5import ReactDOM from "https://esm.sh/react-dom";
6
7function Counter() {
8 const [counter, setCounter] = React.useState(0);
9
19}
20
21export function App() {
22 return (
23 <>

expressHTMLExamplemain.tsx1 match

@destroytoday•Updated 1 year ago
1export async function expressHTMLExample(
2 req: express.Request,
3 res: express.Response,

open_in_fullscreenmain.tsx1 match

@pomdtr•Updated 1 year ago
1import { BrowserContext } from "https://esm.town/v/pomdtr/browser";
2
3export default async function(ctx) {
4 return {
5 type: "open",

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": "*",