gitHubSyncmain.tsx4 matches
277});
278279function Style() {
280return (
281<style>
294}
295296function Logout() {
297return (
298<form action="/logout" method="post">
318319/**
320* This function can be used on its own
321* to commit multiple files to a GitHub repo
322*/
323export async function commitFiles({
324token,
325owner,
64};
6566export default async function(req: Request): Promise<Response> {
67if (req.method === "GET") {
68// handle a GET request
proudJadeSeahorsemain.tsx2 matches
8.join(" OR ") + " " + excludes;
910function relevant(t: Tweet) {
11if (keywords.some(k => t.full_text?.includes(k))) return true;
12return t.entities.urls?.some(u => keywords.some(k => u.expanded_url?.includes(k)));
17const isProd = true;
1819export async function twitterAlert({ lastRunAt }: Interval) {
20// search
21const since = isProd
3132// ------------
33// Functions
34// ------------
3536async function execute(statement: InStatement, args?: InArgs): Promise<ResultSet> {
37const res = await fetch(`${API_URL}/v1/sqlite/execute`, {
38method: "POST",
49}
5051async function batch(statements: InStatement[], mode?: TransactionMode): Promise<ResultSet[]> {
52const res = await fetch(`${API_URL}/v1/sqlite/batch`, {
53method: "POST",
64}
6566function createResError(body: string) {
67try {
68const e = zLibsqlError.parse(JSON.parse(body));
85}
8687function normalizeStatement(statement: InStatement, args?: InArgs) {
88if (Array.isArray(statement)) {
89// for the case of an array of arrays
107}
108109function upgradeResultSet(results: ImpoverishedResultSet): ResultSet {
110return {
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(
119sqlRow: Array<unknown>,
120columns: Array<string>,
cerebras_codermain.tsx11 matches
24);
2526function Hero({
27prompt,
28setPrompt,
4546<p className="text-[#bababa] text-center max-w-[25ch] mx-auto my-4 font-dm-sans">
47Turn your ideas into fully functional apps in{" "}
48<span className="relative w-fit text-fuchsia-400 z-10 italic font-semibold rounded-full">
49less than a second
116}
117118function App() {
119const previewRef = React.useRef<HTMLDivElement>(null);
120const [prompt, setPrompt] = useState("");
170});
171172function handleStarterPromptClick(promptItem: typeof prompts[number]) {
173setLoading(true);
174setTimeout(() => handleSubmit(promptItem.prompt), 0);
175}
176177async function handleSubmit(e: React.FormEvent | string) {
178if (typeof e !== "string") {
179e.preventDefault();
226}
227228function handleVersionChange(direction: "back" | "forward") {
229const { currentVersionIndex, versions } = versionHistory;
230if (direction === "back" && currentVersionIndex > 0) {
974);
975976function client() {
977const path = window.location.pathname;
978const root = createRoot(document.getElementById("root")!);
1010}
10111012function extractCodeFromFence(text: string): string {
1013const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
1014return htmlMatch ? htmlMatch[1].trim() : text;
1015}
10161017async function generateCode(prompt: string, currentCode: string) {
1018const starterPrompt = STARTER_PROMPTS.find(p => p.prompt === prompt);
1019if (starterPrompt) {
1060}
10611062export default async function cerebras_coder(req: Request): Promise<Response> {
1063// Dynamic import for SQLite to avoid client-side import
1064const { 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">
1async function createWorker(url: string) {
2const workerScript = await fetch(url);
3const workerURL = URL.createObjectURL(await workerScript.blob());
twitterAlertmain.tsx3 matches
7const query = keywords.map(k => `"${k}"`).join(" OR ") + " " + excludes;
89// Helper function to filter relevant tweets
10function relevant(tweet: Tweet) {
11return (
12keywords.some(k => tweet.full_text?.includes(k))
18const isProd = true;
1920export async function twitterAlert({ lastRunAt }: Interval) {
21// Scrapes data from past 48 hours if testing
22const since = isProd
textToSixImageGeneratormain.tsx3 matches
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
45function App() {
6const [prompt, setPrompt] = useState("");
7const [images, setImages] = useState<string[]>([]);
205};
206207function client() {
208createRoot(document.getElementById("root")).render(<App />);
209}
210if (typeof document !== "undefined") { client(); }
211212export default async function server(request: Request): Promise<Response> {
213return new Response(`
214<html>
duckdbExamplemain.tsx2 matches
23export let duckdbExample = await (async () => {
4async function createWorker(url) {
5// For Val Town / Deno environments
6if (typeof Deno !== "undefined") {
3839console.log(duckdbExample);
40export default async function(req: Request): Promise<Response> {
41return new Response(JSON.stringify(duckdbExample))
42}
twitterAlertREADME.md1 match
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.