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=1083&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 16864 results for "function"(3390ms)

gitHubSyncmain.tsx4 matches

@tmcw•Updated 3 months ago
277});
278
279function Style() {
280 return (
281 <style>
294}
295
296function Logout() {
297 return (
298 <form action="/logout" method="post">
318
319/**
320 * This function can be used on its own
321 * to commit multiple files to a GitHub repo
322 */
323export async function commitFiles({
324 token,
325 owner,

tldraw_computer_examplemain.tsx1 match

@tmcw•Updated 3 months ago
64};
65
66export default async function(req: Request): Promise<Response> {
67 if (req.method === "GET") {
68 // handle a GET request

proudJadeSeahorsemain.tsx2 matches

@tmcw•Updated 3 months ago
8 .join(" OR ") + " " + excludes;
9
10function relevant(t: Tweet) {
11 if (keywords.some(k => t.full_text?.includes(k))) return true;
12 return t.entities.urls?.some(u => keywords.some(k => u.expanded_url?.includes(k)));
17const isProd = true;
18
19export async function twitterAlert({ lastRunAt }: Interval) {
20 // search
21 const since = isProd

sqlitemain.tsx7 matches

@tmcw•Updated 3 months ago
31
32// ------------
33// Functions
34// ------------
35
36async function execute(statement: InStatement, args?: InArgs): Promise<ResultSet> {
37 const res = await fetch(`${API_URL}/v1/sqlite/execute`, {
38 method: "POST",
49}
50
51async function batch(statements: InStatement[], mode?: TransactionMode): Promise<ResultSet[]> {
52 const res = await fetch(`${API_URL}/v1/sqlite/batch`, {
53 method: "POST",
64}
65
66function createResError(body: string) {
67 try {
68 const e = zLibsqlError.parse(JSON.parse(body));
85}
86
87function normalizeStatement(statement: InStatement, args?: InArgs) {
88 if (Array.isArray(statement)) {
89 // for the case of an array of arrays
107}
108
109function upgradeResultSet(results: ImpoverishedResultSet): ResultSet {
110 return {
111 ...results,
116// adapted from
117// https://github.com/tursodatabase/libsql-client-ts/blob/17dd996b840c950dd22b871adfe4ba0eb4a5ead3/packages/libsql-client/src/sqlite3.ts#L314C1-L337C2
118function rowFromSql(
119 sqlRow: Array<unknown>,
120 columns: Array<string>,

cerebras_codermain.tsx11 matches

@shivdwipgo•Updated 3 months ago
24);
25
26function Hero({
27 prompt,
28 setPrompt,
45
46 <p className="text-[#bababa] text-center max-w-[25ch] mx-auto my-4 font-dm-sans">
47 Turn your ideas into fully functional apps in{" "}
48 <span className="relative w-fit text-fuchsia-400 z-10 italic font-semibold rounded-full">
49 less than a second
116}
117
118function App() {
119 const previewRef = React.useRef<HTMLDivElement>(null);
120 const [prompt, setPrompt] = useState("");
170 });
171
172 function handleStarterPromptClick(promptItem: typeof prompts[number]) {
173 setLoading(true);
174 setTimeout(() => handleSubmit(promptItem.prompt), 0);
175 }
176
177 async function handleSubmit(e: React.FormEvent | string) {
178 if (typeof e !== "string") {
179 e.preventDefault();
226 }
227
228 function handleVersionChange(direction: "back" | "forward") {
229 const { currentVersionIndex, versions } = versionHistory;
230 if (direction === "back" && currentVersionIndex > 0) {
974);
975
976function client() {
977 const path = window.location.pathname;
978 const root = createRoot(document.getElementById("root")!);
1010}
1011
1012function extractCodeFromFence(text: string): string {
1013 const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
1014 return htmlMatch ? htmlMatch[1].trim() : text;
1015}
1016
1017async function generateCode(prompt: string, currentCode: string) {
1018 const starterPrompt = STARTER_PROMPTS.find(p => p.prompt === prompt);
1019 if (starterPrompt) {
1060}
1061
1062export default async function cerebras_coder(req: Request): Promise<Response> {
1063 // Dynamic import for SQLite to avoid client-side import
1064 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
1163 <meta property="og:site_name" content="Cerebras Coder">
1164 <meta property="og:url" content="https://cerebrascoder.com"/>
1165 <meta property="og:description" content="Turn your ideas into fully functional apps in less than a second – powered by Llama3.3-70b on Cerebras's super-fast wafer chips. Code is 100% open-source, hosted on Val Town."">
1166 <meta property="og:type" content="website">
1167 <meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">

getDuckDBmain.tsx1 match

@maxm•Updated 3 months ago
1async function createWorker(url: string) {
2 const workerScript = await fetch(url);
3 const workerURL = URL.createObjectURL(await workerScript.blob());

twitterAlertmain.tsx3 matches

@charmaine•Updated 3 months ago
7const query = keywords.map(k => `"${k}"`).join(" OR ") + " " + excludes;
8
9// Helper function to filter relevant tweets
10function relevant(tweet: Tweet) {
11 return (
12 keywords.some(k => tweet.full_text?.includes(k))
18const isProd = true;
19
20export async function twitterAlert({ lastRunAt }: Interval) {
21 // Scrapes data from past 48 hours if testing
22 const since = isProd

textToSixImageGeneratormain.tsx3 matches

@Nandu•Updated 3 months ago
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4
5function App() {
6 const [prompt, setPrompt] = useState("");
7 const [images, setImages] = useState<string[]>([]);
205};
206
207function client() {
208 createRoot(document.getElementById("root")).render(<App />);
209}
210if (typeof document !== "undefined") { client(); }
211
212export default async function server(request: Request): Promise<Response> {
213 return new Response(`
214 <html>

duckdbExamplemain.tsx2 matches

@taras•Updated 3 months ago
2
3export let duckdbExample = await (async () => {
4 async function createWorker(url) {
5 // For Val Town / Deno environments
6 if (typeof Deno !== "undefined") {
38
39console.log(duckdbExample);
40export default async function(req: Request): Promise<Response> {
41 return new Response(JSON.stringify(duckdbExample))
42}

twitterAlertREADME.md1 match

@charmaine•Updated 3 months ago
54This val uses the SocialData API for Twitter data:
55- **Proxies via Val Town's SocialDataProxy**: Limited to 100 calls/day for [**Val Town Pro users**](https://www.val.town/pricing).
56- **Need more calls?** Sign up for your own [SocialData API token](https://socialdata.tools) and configure the [`socialDataSearch`](https://www.val.town/v/stevekrouse/socialDataSearch) function.

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