relaxedSalmonHawkmain.tsx1 match
1export default async function handler(request: Request) {
2if (request.method !== "POST") {
3return Response.json({ message: "This val responds to POST requests." }, {
linkInBioTemplatemain.tsx1 match
2import { renderToString } from "npm:react-dom/server";
34export default async function(req: Request) {
5return new Response(
6renderToString(
BlogChatbotServermain.tsx5 matches
25];
2627// Function to search blog content
28function searchBlogContent(query: string) {
29return blogPosts.filter(post =>
30post.title.toLowerCase().includes(query.toLowerCase()) ||
58const sendButton = document.getElementById('sendButton');
5960function addMessage(message, isUser = false) {
61const messageElem = document.createElement('p');
62messageElem.textContent = isUser ? \`You: \${message}\` : \`Bot: \${message}\`;
66}
6768async function sendMessage() {
69const message = userInput.value.trim();
70if (!message) return;
136});
137138export default async function server(req: Request): Promise<Response> {
139return app.fetch(req);
140}
pushSendNotification_negrelmain.tsx3 matches
23// https://github.com/web-push-libs/web-push/blob/v3.4.4/README.md#using-vapid-key-for-applicationserverkey
4function urlBase64ToUint8Array(b64) {
5const padding = "=".repeat((4 - (b64.length % 4)) % 4);
6const base64 = (b64 + padding)
1920// https://stackoverflow.com/a/56848917/9068081
21function getPrivKeyJWK({ pubKey, privKey }: { pubKey: string; privKey: string }) {
22const pubKeyArray = urlBase64ToUint8Array(pubKey);
23const privKeyArray = urlBase64ToUint8Array(privKey);
49};
5051async function importVapidKeys(
52exportedKeys: { pubKey: string; privKey: string },
53{ crypto = globalThis.crypto.subtle, extractable = false }: {
1import { OpenAI } from "https://esm.town/v/std/openai";
2export default async function(req: Request): Promise<Response> {
3const openai = new OpenAI();
4const stream = await openai.chat.completions.create({
15`);
1617export default async function(req: Request): Promise<Response> {
18await db.query(`
19UPDATE test
isMyWebsiteDownmain.tsx1 match
6);
78export async function uptimeCheck(url: string) {
9let ok = true;
10let reason: string;
CIDGenerationmain.tsx2 matches
31};
3233async function main() {
34try {
35const jsonData = {
46}
4748async function pinFileToIPFS() {
49try {
50const jsonData = {
2import { parseAuthorizationHeader } from "https://esm.town/v/pomdtr/parseAuthorizationHeader";
34export default async function(req: Request) {
5const url = new URL(req.url);
6const parts = url.pathname.slice(1).split("/");
1/**
2* This application creates a CSV viewer using a Hono app that serves a client-side application.
3* It allows users to upload a CSV file, view its contents in a table format, and provides basic sorting functionality.
4*
5* The approach:
6* 1. Create a server-side Hono app to handle file uploads and serve the HTML, CSS, and JavaScript.
7* 2. Implement client-side JavaScript to handle file reading, parsing CSV, and displaying the data in a table.
8* 3. Add sorting functionality to allow users to sort the table by clicking on column headers.
9*
10* Libraries used:
16import { Hono } from 'npm:hono';
1718function html() {
19/*
20<!DOCTYPE html>
38}
3940function css() {
41/*
42body {
99}
100101function js() {
102/*
103import Papa from 'https://esm.sh/papaparse@5.4.1';
111fileInput.addEventListener('change', handleFileUpload);
112113function handleFileUpload(event) {
114const file = event.target.files[0];
115if (file) {
116Papa.parse(file, {
117complete: function(results) {
118currentData = results.data;
119currentHeaders = currentData[0];
124}
125126function displayTable(data) {
127if (data.length === 0) return;
128152}
153154function sortTable(column) {
155const columnIndex = currentHeaders.indexOf(column);
156if (columnIndex === -1) return;