3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
45function generateRandomColor() {
6const hue = Math.floor(Math.random() * 360);
7return `hsl(${hue}, 70%, 50%)`;
8}
910function parseICSDate(dateString: string): Date {
11if (!dateString) return new Date();
1236}
3738function parseICSContent(content: string) {
39try {
40console.log("Parsing ICS content:", content);
75}
7677function Calendar() {
78const [events, setEvents] = useState([
79{
309}
310311function client() {
312createRoot(document.getElementById("root")).render(<Calendar />);
313}
315if (typeof document !== "undefined") { client(); }
316317export default async function server(request: Request): Promise<Response> {
318return new Response(`
319<html>
opengraphImageCreatormain.tsx3 matches
48}
4950function App() {
51const [backgroundImage, setBackgroundImage] = useState<string | null>(null);
52const [backgroundConfig, setBackgroundConfig] = useState<BackgroundConfig>({
410}
411412function client() {
413createRoot(document.getElementById("root")).render(<App />);
414}
415if (typeof document !== "undefined") { client(); }
416417export default async function server(request: Request): Promise<Response> {
418return new Response(`
419<html>
opengraphImageCreatormain.tsx3 matches
48}
4950function App() {
51const [backgroundImage, setBackgroundImage] = useState<string | null>(null);
52const [backgroundConfig, setBackgroundConfig] = useState<BackgroundConfig>({
410}
411412function client() {
413createRoot(document.getElementById("root")).render(<App />);
414}
415if (typeof document !== "undefined") { client(); }
416417export default async function server(request: Request): Promise<Response> {
418return new Response(`
419<html>
SermonGPTUImain.tsx5 matches
78const endpointURL = "https://mjweaver01-sermongptapi.web.val.run";
7980function App() {
81const [question, setQuestion] = useState("");
82const [response, setResponse] = useState("");
617}
618619function client() {
620const root = document.getElementById("root");
621if (!root) throw new Error("Root element not found");
633}
634635export default async function server(request: Request): Promise<Response> {
636const { blob } = await import("https://esm.town/v/std/blob");
637664}
665666// Helper function to determine season based on current date
667function getSeason(date: Date): string {
668const month = date.getMonth();
669switch (true) {
emojiVectorEmbeddingsmain.tsx11 matches
15]);
16// Get embedding for a single emoji
17async function getEmbedding(emoji: string): Promise<number[]> {
18const result = await openai.embeddings.create({
19input: emoji,
23}
2425async function loadEmoji(e: string) {
26const result = await sqlite.execute("SELECT 1 FROM emojis WHERE emoji = ?", [e]);
27if (result.rows.length !== 0) {
43}
4445async function loadAllEmojis() {
46const batchSize = 20;
47for (let i = 0; i < emojis.length; i += batchSize) {
54// await loadAllEmojis();
5556export async function searchEmojis(query: string): Promise<string[]> {
57return (await sqlite.execute(
58`SELECT emoji
70// };
7172// // Function to get all emojis (this is a subset for demonstration)
7374// // Calculate cosine similarity between two vectors
75// function cosineSimilarity(vecA: number[], vecB: number[]): number {
76// const dotProduct = vecA.reduce((sum, a, i) => sum + a * vecB[i], 0);
77// const magnitudeA = Math.sqrt(vecA.reduce((sum, a) => sum + a * a, 0));
8182// // Get embedding for a single emoji
83// async function getEmbedding(emoji: string): Promise<number[]> {
84// const result = await openai.embeddings.create({
85// input: emoji,
9091// // Get embeddings for all emojis
92// async function getAllEmbeddings(): Promise<EmojiEmbedding[]> {
93// const emojis = getAllEmojis();
94// const embeddings: EmojiEmbedding[] = [];
116117// // Find nearest neighbors for a given emoji
118// function findNearestNeighbors(
119// targetEmbedding: number[],
120// allEmbeddings: EmojiEmbedding[],
130// }
131132// // Main function to demonstrate usage
133// async function main() {
134// try {
135// console.log("Getting embeddings for all emojis...");
SermonGPTAPImain.tsx2 matches
1export default async function server(request: Request): Promise<Response> {
2const { blob } = await import("https://esm.town/v/std/blob");
3const KEY = "sermon_generator";
182}
183184function getSeason(date: Date): string {
185const month = date.getMonth();
186switch (true) {
6console.log(AnimatePresence);
78function ErrorMessage({ message }) {
9return (
10<div className="min-h-screen bg-gray-100 flex items-center justify-center p-4">
17}
1819function Loader() {
20return (
21<div className="flex flex-col items-center justify-center min-h-screen bg-gray-100">
57}
5859function shuffleArray(array) {
60const shuffledArray = [...array];
61for (let i = shuffledArray.length - 1; i > 0; i--) {
66}
6768function RecordCard() {
69const [records, setRecords] = useState([]);
70const [currentRecordIndex, setCurrentRecordIndex] = useState(0);
7778useEffect(() => {
79async function fetchReleases() {
80try {
81const response = await fetch("https://ashryanio-getallreleasesfromdiscogs.web.val.run");
130131useEffect(() => {
132function handleKeydown(event) {
133if (
134event.target.tagName.toLowerCase() !== "input"
340}
341342function client() {
343const rootElement = document.getElementById("root");
344if (!rootElement) {
359}
360361export default async function server(request: Request): Promise<Response> {
362const url = new URL(request.url);
363
Ms_Spanglermain.tsx11 matches
153const typingIndicator = document.querySelector('.typing-indicator');
154155function addMessage(content, type) {
156const messageElement = document.createElement('div');
157messageElement.classList.add('message', type);
161}
162163function loadChatHistories() {
164try {
165const savedChatsRaw = localStorage.getItem('chatHistories');
167
168chatHistorySelect.innerHTML = '';
169savedChats.forEach(function(chat, index) {
170const option = document.createElement('option');
171option.value = index;
178}
179180function saveChat() {
181try {
182const chatName = prompt('Enter a name for this chat history:') || ('Chat ' + Date.now());
183const messages = Array.from(chatMessages.children).map(function(msg) {
184return {
185content: msg.textContent,
200}
201202function loadSelectedChat() {
203try {
204const selectedIndex = chatHistorySelect.value;
211if (selectedChat) {
212chatMessages.innerHTML = '';
213selectedChat.messages.forEach(function(msg) {
214addMessage(msg.content, msg.type === 'user' ? 'user-message' : 'ai-message');
215});
221}
222223function deleteSelectedChat() {
224try {
225const selectedIndex = chatHistorySelect.value;
239}
240241async function sendMessage() {
242const message = messageInput.value.trim();
243if (!message) return;
270loadButton.addEventListener('click', loadSelectedChat);
271deleteButton.addEventListener('click', deleteSelectedChat);
272messageInput.addEventListener('keypress', function(e) {
273if (e.key === 'Enter') sendMessage();
274});
308} catch (error) {
309console.error("OpenAI error:", error);
310return c.json({ response: "Neural networks malfunctioning. Try again, human." });
311}
312});
gameplay_agentmain.tsx5 matches
83/** The name of the agent. */
84agentname: string;
85/** The agent function. */
86agent: Connect4Agent<T> | Connect4AsyncAgent<T>;
87}
99/** The name of the agent. */
100agentname: string;
101/** The agent function. */
102agent: PokerAgent<T> | PokerAsyncAgent<T>;
103}
121* a variety of different http server libraries.
122*
123* To see how to write the agent functions,
124* see the {@link Connect4Agent} and {@link PokerAgent}
125*
134* used with an http server that supports the fetch interface.
135*/
136export function agentHandler<
137T extends Json = Json,
138>(
139agents: AgentSpec<T>[],
140): (req: Request) => Promise<Response> {
141return async function(request: Request): Promise<Response> {
142if (request.method === "GET") {
143return Response.json({
whoIsHiringmain.tsx3 matches
7import About from "https://esm.town/v/vawogbemi/whoIsHiringAbout";
89function App() {
10const tabs = { "/": "Home", "/about": "About" };
11const [activeTab, setActiveTab] = useState("/");
335}
336337function ServerApp() {
338return (
339<html>
358}
359360export default async function(req: Request): Promise<Response> {
361const url = new URL(req.url);
362if (url.pathname === "/api/stories") {