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=647&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 10842 results for "function"(624ms)

cerebras_coderindex.html1 match

@drax•Updated 1 month ago
19 <meta property="og:site_name" content="Cerebras Coder">
20 <meta property="og:url" content="https://cerebrascoder.com"/>
21 <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."">
22 <meta property="og:type" content="website">
23 <meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">

cerebras_coderindex2 matches

@drax•Updated 1 month ago
3import { createProject, getCode, getNextVersionNumber, insertVersion } from "./database/queries";
4
5async function servePublicFile(path: string): Promise<Response> {
6 const url = new URL("./public/" + path, import.meta.url);
7 const text = await (await fetch(url, {
20await createTables();
21
22export default async function cerebras_coder(req: Request): Promise<Response> {
23 if (req.method === "POST") {
24 let { prompt, currentCode, versionHistory, projectId } = await req.json();

cerebras_coderindex7 matches

@drax•Updated 1 month ago
23);
24
25function Hero({
26 prompt,
27 setPrompt,
44
45 <p className="text-[#bababa] text-center max-w-[25ch] mx-auto my-4 font-dm-sans">
46 Turn your ideas into fully functional apps in{" "}
47 <span className="relative w-fit text-fuchsia-400 z-10 italic font-semibold rounded-full">
48 less than a second
115}
116
117function App() {
118 const previewRef = React.useRef<HTMLDivElement>(null);
119 const [prompt, setPrompt] = useState("");
169 });
170
171 function handleStarterPromptClick(promptItem: typeof prompts[number]) {
172 setLoading(true);
173 setTimeout(() => handleSubmit(promptItem.prompt), 0);
174 }
175
176 async function handleSubmit(e: React.FormEvent | string) {
177 if (typeof e !== "string") {
178 e.preventDefault();
225 }
226
227 function handleVersionChange(direction: "back" | "forward") {
228 const { currentVersionIndex, versions } = versionHistory;
229 if (direction === "back" && currentVersionIndex > 0) {
973);
974
975function client() {
976 const path = window.location.pathname;
977 const root = createRoot(document.getElementById("root")!);

cerebras_codergenerate-code2 matches

@drax•Updated 1 month ago
2import STARTER_PROMPTS from "../public/starter-prompts.js";
3
4function extractCodeFromFence(text: string): string {
5 const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
6 return htmlMatch ? htmlMatch[1].trim() : text;
7}
8
9export async function generateCode(prompt: string, currentCode: string) {
10 const starterPrompt = STARTER_PROMPTS.find(p => p.prompt === prompt);
11 if (starterPrompt) {

subaudiomain.tsx4 matches

@stevekrouse•Updated 1 month ago
22// The first timestamp should be 0.`;
23
24// async function processAudio(audio_uri) {
25// const substrate = new Substrate({ apiKey: Deno.env.get("SUBSTRATE_API_KEY") });
26// const opts = { cache_age: 60 * 60 * 24 * 7 };
91
92// // Render site
93// export default async function(req: Request): Promise<Response> {
94// const url = new URL(req.url);
95// const audio_uri = url.searchParams.get("url");
400// let currentChapterIndex = 0;
401
402// function updateText() {
403// const currentTime = audioPlayer.currentTime;
404// let segmentToDisplay = null;
515// const updateInterval = 1000 / 40;
516
517// function updateLoop(timestamp) {
518// if (timestamp - lastUpdateTime > updateInterval) {
519// updateText();

GitHubSyncvaltown-deploy6 matches

@ka12m•Updated 1 month ago
17////
18
19export default async function valTownDeploy(c: Context) {
20 console.log("deploy to valtown");
21 const body = await c.req.json();
45}
46
47async function getContents(repo: Repo, after: string, commits: Commit[]) {
48 const filenames = config.vals.map((name: string) => name + ".tsx");
49 console.log(`${filenames.length} val files updated`);
55}
56
57function getModified(commits: Commit[], filenames: string[]) {
58 return commits.reduce((a: string[], b: Commit) => {
59 return [...a, ...b.modified];
61}
62
63function getFileContent(repo: Repo, after: string) {
64 return async (path: string): Promise<{
65 name: string;
81}
82
83async function updateVals(user: ValUser, updates: { name: string; code: string; }[]) {
84 console.log("updateVals");
85 await Promise.all(updates.map(async (update) => {
88}
89
90async function updateVal(username: string, update: { name: string; code: string; }) {
91 const { name, code } = update;
92 const val = await valtown.alias.username.valName.retrieve(username, name);

GitHubSyncsign-webhook1 match

@ka12m•Updated 1 month ago
1/**
2 * Use this function along with your valtown webhook secret to create
3 * the x-val-signature header when posting to the /export webhook
4 */

GitHubSyncREADME.md1 match

@ka12m•Updated 1 month ago
42const url = Deno.env.get("PUSH_URL") as string;
43
44async function pushValsToGitHub() {
45 const body = "hello";
46 const signature = await sign(body, secret);

GitHubSynchome1 match

@ka12m•Updated 1 month ago
4import type { Context } from "npm:hono";
5
6export default async function(c: Context) {
7 return c.html(
8 <html>

GitHubSyncgithub-push1 match

@ka12m•Updated 1 month ago
12const valtown = new ValTown();
13
14export default async function GitHubPush(c: Context) {
15 // auth check in /index
16 const user = await valtown.me.profile.retrieve();

getFileEmail4 file matches

@shouser•Updated 1 week ago
A helper function to build a file's email

TwilioHelperFunctions

@vawogbemi•Updated 2 months ago