118}
119120function App() {
121const [prompt, setPrompt] = useState("");
122const [generationResult, setGenerationResult] = useState<{
128const [error, setError] = useState<string | null>(null);
129130async function handleSubmit(e: React.FormEvent) {
131e.preventDefault();
132setLoading(true);
195}
196197function client() {
198createRoot(document.getElementById("root")!).render(<App />);
199}
201if (typeof document !== "undefined") { client(); }
202203export default async function server(req: Request): Promise<Response> {
204return new Response(
205`
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>,
2import { renderToString } from "npm:react-dom/server";
34export default async function(req: Request) {
5return new Response(
6renderToString(
tfidf_analyser_90s_versionmain.tsx14 matches
17]);
1819// Function to calculate TF-IDF
20function calculateTFIDF(text, outputSize = 7) {
21const words = text.toLowerCase().match(/\b[a-z]{2,}\b/g) || [];
22const wordCount = words.length;
61}
6263// Function to calculate word frequency
64function calculateWordFrequency(text, topN = 30) {
65const words = text.toLowerCase().match(/\b[a-z]{3,}\b/g) || [];
66const frequency = {};
75}
7677// Function to generate a fun fact
78function generateFunFact(text) {
79const wordCount = text.trim().split(/\s+/).length;
80const charCount = text.length;
96}
9798// Function to perform simple sentiment analysis
99function analyseSentiment(text) {
100const positiveWords = new Set([
101"good", "great", "excellent", "wonderful", "amazing", "fantastic", "awesome", "happy", "joy", "love",
124}
125126// Function to generate a simple summary
127function generateSummary(text, sentenceCount = 3) {
128const sentences = text.match(/[^\.!\?]+[\.!\?]+/g) || [];
129return sentences.slice(0, sentenceCount).join(" ");
336});
337338async function analyseText() {
339const text = inputText.value.trim();
340
389}
390391function displayResult(data) {
392let tfidfHtml = '<br><h3>Top TF-IDF Scores:</h3>';
393tfidfHtml += '<p><em>How it works: TF-IDF calculates the importance of words by multiplying how often they appear in the text (TF) with how unique they are across all documents (IDF). This helps identify key terms that are both frequent and distinctive in the text.</em></p>';
440441// Client-side character count limit
442inputText.addEventListener('input', function() {
443if (this.value.length > 100000) {
444this.value = this.value.slice(0, 100000);
503});
504505export default async function(request: Request): Promise<Response> {
506return app.fetch(request);
507}
twitterAlertmain.tsx1 match
4const query = "\"val.town\" OR \"val.run\" OR \"val town\" -_ValTown_ -is:retweet -from:valenzuelacity -from:val__run";
56export async function twitterAlert({ lastRunAt }: Interval) {
7// search
8// const since = Math.floor((Date.now() / 1000) - (24 * 60 * 60)); // test since for last day
cerebras_codermain.tsx5 matches
6import { tomorrow } from "https://esm.sh/react-syntax-highlighter/dist/esm/styles/prism";
78function App() {
9const [prompt, setPrompt] = useState("hello llamapalooza");
10const [code, setCode] = useState("");
18>(null);
1920async function handleSubmit(e: React.FormEvent) {
21e.preventDefault();
22setLoading(true);
97}
9899function client() {
100createRoot(document.getElementById("root")!).render(<App />);
101}
105}
106107function extractCodeFromFence(text: string): string {
108const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
109return htmlMatch ? htmlMatch[1].trim() : text;
110}
111112export default async function server(req: Request): Promise<Response> {
113if (req.method === "POST") {
114const client = new Cerebras();
genuineBrownErminemain.tsx5 matches
3import { createRoot } from "https://esm.sh/react-dom/client";
45function NodeJSLearningTodoList() {
6const initialTasks = [
7{
18{
19text: "Funciones",
20description: "Aprende sobre funciones regulares, arrow functions, parámetros, scope y cierres (closures).",
21completed: false
22},
327}
328329function App() {
330return <NodeJSLearningTodoList />;
331}
332333function client() {
334createRoot(document.getElementById("root")).render(<App />);
335}
336if (typeof document !== "undefined") { client(); }
337338export default async function server(request: Request): Promise<Response> {
339return new Response(`
340<html>
cekdatatruckmain.tsx5 matches
16const transportTypes = ["Industri", "SPBU", "Kero"];
1718function AddVehicleForm({ company, onVehicleAdded, onCancel }) {
19const [formData, setFormData] = useState({
20plateNumber: "",
115}
116117function AllVehiclesTable({ onClose }) {
118const [vehicles, setVehicles] = useState([]);
119const [sortConfig, setSortConfig] = useState({ key: null, direction: "ascending" });
202}
203204function App() {
205const [selectedCompany, setSelectedCompany] = useState(null);
206const [showScanner, setShowScanner] = useState(false);
450}
451452function client() {
453createRoot(document.getElementById("root")).render(<App />);
454}
456if (typeof document !== "undefined") { client(); }
457458export default async function server(request: Request): Promise<Response> {
459const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
460const SCHEMA_VERSION = 2;
qualityBrownTyrannosaurusmain.tsx3 matches
5const STORAGE_KEY = "nodeJSLearningPath";
67function NodeJSLearningRoadmap() {
8const [learningPath, setLearningPath] = useState(() => {
9const savedPath = localStorage.getItem(STORAGE_KEY);
168}
169170function client() {
171createRoot(document.getElementById("root")).render(<NodeJSLearningRoadmap />);
172}
173if (typeof document !== "undefined") { client(); }
174175export default async function server(request: Request): Promise<Response> {
176return new Response(
177`
email_jokemain.tsx1 match
23// Fetches a random joke.
4async function fetchRandomJoke() {
5const response = await fetch(
6"https://official-joke-api.appspot.com/random_joke",