photoEditingAIAppmain.tsx3 matches
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
45function App() {
6const [uploadedImage, setUploadedImage] = useState(null);
7const [generatedImage, setGeneratedImage] = useState(null);
137}
138139function client() {
140createRoot(document.getElementById("root")).render(<App />);
141}
142if (typeof document !== "undefined") { client(); }
143144export default async function server(request: Request): Promise<Response> {
145const { blob } = await import("https://esm.town/v/std/blob");
146const { OpenAI } = await import("https://esm.town/v/std/openai");
originalTomatoLynxmain.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">
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">
sipCalculatormain.tsx3 matches
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
45function SIPCalculator() {
6const [monthlyInvestment, setMonthlyInvestment] = useState(5000);
7const [expectedReturn, setExpectedReturn] = useState(12);
73}
7475function client() {
76createRoot(document.getElementById("root")).render(<SIPCalculator />);
77}
78if (typeof document !== "undefined") { client(); }
7980export default async function server(request: Request): Promise<Response> {
81return new Response(`
82<html>
reactPinterestClonemain.tsx7 matches
13}
1415function Logo() {
16return (
17<div className="logo-container">
28}
2930function BlogPostCard({ post, onDelete }) {
31return (
32<div className="blog-post-card">
50}
5152function BlogPostForm({ onSubmit }) {
53const [title, setTitle] = useState('');
54const [content, setContent] = useState('');
111}
112113function App() {
114const [posts, setPosts] = useState<BlogPost[]>([]);
115const [error, setError] = useState<string | null>(null);
116117useEffect(() => {
118async function fetchPosts() {
119try {
120const response = await fetch('/get-posts');
220}
221222function client() {
223createRoot(document.getElementById("root")).render(<App />);
224}
225if (typeof document !== "undefined") { client(); }
226227export default async function server(request: Request): Promise<Response> {
228const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
229const KEY = "reactPinterestClone";
3const emojiHostBaseUrl = "https://majestic-sundae-60b0a3.netlify.app";
45export default async function replaceEmojisWithImages(html: string): Promise<string> {
6let unemojiHtml = unemojify(html);
7
audioManagermain.tsx8 matches
4344export class AudioManager {
45constructor(apiKey=null, uploadFunction = null, downloadFunction = null) {
46this.openai = new OpenAI(apiKey);
47this.uploadFunction = uploadFunction || this.blobUpload;
48}
4950// valtown blob upload function
51async blobUpload(buffer, key) {
52try {
111console.log(blob instanceof Blob); // Should be true
112console.log(typeof blob); // Should be true
113console.log(typeof blob.arrayBuffer); // Should be "function"
114return blob;
115}
164165async uploadAudio(blob, key) {
166if (!this.uploadFunction) {
167console.error("No upload function provided to upload audio");
168return null;
169}
170171// const buffer = await blob.arrayBuffer();
172const res = await this.uploadFunction(blob, key);
173if (res) {
174return res;
180181182// Function to fetch audio data and return as ArrayBuffer
183async getAudioBuffer(url) {
184const response = await fetch(url);
btcPriceAlertmain.tsx2 matches
6const THRESHOLD = 0.1; // 10 %
78async function welcome(btcPrice: number) {
9let formattedBtcPrice = formatAsCurrency(btcPrice);
10let text = `The BTC price is now ${formattedBtcPrice}.
18}
1920export async function btcPriceAlert() {
21let btcPrice = await currency("usd", "btc");
22const lastBtcPrice: number | undefined = await blob.getJSON("lastBtcPrice");
22}
2324function getFileEmote(file: RTCFile) {
25const fileType = file.type.split("/")[0];
26switch (fileType) {
59const buttonHover = Object.values(ButtonHover)[randomIndex];
6061function App() {
62const [showModal, setShowModal] = useState(false);
63const [peerId, setPeerId] = useState("");
376}
377378function client() {
379render(<App />, document.getElementById("root")!);
380}
415`;
416417export default async function server(request: Request): Promise<Response> {
418const url = new URL(request.url);
419
bombCycloneOutageTrackermain.tsx7 matches
16import { PSE_OUTAGES_TABLE_NAME } from "https://esm.town/v/andreterron/PSEoutages";
1718function formatXAxis(tickItem: number | Date) {
19return format(tickItem, "MMM d h:mmaaa");
20}
2122function App() {
23const [outageData, setOutageData] = useState([]);
24// const [regressionData, setRegressionData] = useState<any[]>([]);
2526useEffect(() => {
27async function fetchData() {
28const response = await fetch("/outages");
29const json = await response.json();
46});
47});
48function timeToX(time: number) {
49return (time - firstEntry.time) / 1000 / 60 / 60 / 24;
50}
51function xToTime(x: number) {
52return x * 60 * 60 * 24 * 1000 + firstEntry.time;
53}
188}
189190async function client() {
191const ReactDOM = await import("https://esm.sh/react-dom@18");
192console.log(ReactDOM);
196if (typeof document !== "undefined") { client(); }
197198export default async function server(request: Request): Promise<Response> {
199const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
200