specialBlackMosquitomain.tsx3 matches
3import { createRoot } from "https://esm.sh/react-dom/client";
45function App() {
6return (
7<div>
11}
1213function client() {
14createRoot(document.getElementById("root")).render(<App />);
15}
16if (typeof document !== "undefined") { client(); }
1718export default async function server(request: Request): Promise<Response> {
19return new Response(`
20<html>
slackScoutmain.tsx10 matches
15}
1617export default async function(interval: Interval): Promise<void> {
18try {
19await createTable();
3839// Create an SQLite table
40async function createTable(): Promise<void> {
41await sqlite.execute(`
42CREATE TABLE IF NOT EXISTS ${TABLE_NAME} (
5051// Fetch Hacker news, Twitter, and Reddit results
52async function fetchHackerNewsResults(topic: string): Promise<Website[]> {
53return hackerNewsSearch({
54query: topic,
58}
5960async function fetchTwitterResults(topic: string): Promise<Website[]> {
61return twitterSearch({
62query: topic,
67}
6869async function fetchRedditResults(topic: string): Promise<Website[]> {
70return redditSearch({ query: topic });
71}
7273function formatSlackMessage(website: Website): string {
74const displayTitle = website.title || website.url;
75return `*<${website.url}|${displayTitle}>*
78}
7980async function sendSlackMessage(message: string): Promise<Response> {
81const slackWebhookUrl = Deno.env.get("SLACK_WEBHOOK_URL");
82if (!slackWebhookUrl) {
104}
105106async function isURLInTable(url: string): Promise<boolean> {
107const result = await sqlite.execute({
108sql: `SELECT 1 FROM ${TABLE_NAME} WHERE url = :url LIMIT 1`,
112}
113114async function addWebsiteToTable(website: Website): Promise<void> {
115await sqlite.execute({
116sql: `INSERT INTO ${TABLE_NAME} (source, url, title, date_published)
120}
121122async function processResults(results: Website[]): Promise<void> {
123for (const website of results) {
124if (!(await isURLInTable(website.url))) {
12* @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
13* @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
14* @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
15* @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
16* @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
reqEvaltownmain.tsx4 matches
1import net, { AddressInfo } from "node:net";
23export default async function(req: Request): Promise<Response> {
4return serveRequest(
5req,
6`data:text/tsx,${
7encodeURIComponent(`
8export default async function(req: Request): Promise<Response> {
9return Response.json("I am within a worker!")
10}
14}
1516export async function serveRequest(req: Request, importUrl: string): Promise<Response> {
17let port = await getFreePort();
18const worker = new Worker(`https://esm.town/v/maxm/evaltownWorker?cachebust=${crypto.randomUUID()}`, {
56});
5758export async function isPortListening(port: number): Promise<boolean> {
59let isListening = false;
60const maxWaitTime = 2000; // ms
valtowntownmain.tsx5 matches
48await contentStore.init();
4950function Town() {
51return (
52<div
69}
7071function HomePage() {
72return (
73<html>
82<form method="POST" action="/submit">
83<textarea name="handler" rows={10} cols={50} autoFocus>
84{`export default async function(req: Request) {
85return Response.json("Hello, world!");
86}`}
95}
9697function ContentPage({ handler, id }: { handler: string; id: string }) {
98return (
99<html>
122let originalContent = textarea.value;
123124textarea.addEventListener('input', function() {
125if (textarea.value !== originalContent) {
126submitButton.style.display = 'inline-block';
graphqlAPIEndpointmain.tsx5 matches
15});
1617// Function to handle GraphQL requests
18async function handleGraphQLRequest(request: Request): Promise<Response> {
19const { query, variables } = await request.json();
2030}
3132// HTTP handler function
33export default altairClient(async function(req: Request): Promise<Response> {
34return handleGraphQLRequest(req);
35});
3637// Without the Altair GraphQL client:
38// export default async function(req: Request): Promise<Response> {
39// if (req.method === "POST") {
40// return handleGraphQLRequest(req);
altairClientmain.tsx2 matches
3import { getDistDirectory, renderAltair, RenderOptions } from "npm:altair-static";
45export function altairClient(next: (request: Request) => Response | Promise<Response>, options?: RenderOptions) {
6return async (request: Request) => {
7const { pathname } = new URL(request.url);
26}
2728export default altairClient(async function(request: Request): Promise<Response> {
29return new Response("Not found", { status: 404 });
30});
altairClientREADME.md4 matches
22});
2324// Function to handle GraphQL requests
25async function handleGraphQLRequest(request: Request): Promise<Response> {
26const { query, variables } = await request.json();
2739}
4041// HTTP handler function
42export default altairClient(async function(req: Request): Promise<Response> {
43if (req.method === "POST") {
44return handleGraphQLRequest(req);
getProfileProfilePagemain.tsx9 matches
40});
4142async function getProfile(username: string): Promise<Profile | null> {
43const response = await social.get({
44keys: [`${username}/profile/**`],
54}
5556function SkeletonLoader() {
57return (
58<div className="w-full flex flex-col items-center justify-center space-y-4">
70}
7172function BirthdayBanner({ name }: { name: string }) {
73return (
74<div className="birthday-banner">
78}
7980function launchConfetti() {
81const defaults = { startVelocity: 45, spread: 90, ticks: 100, zIndex: 1000 };
8296}
9798function App({ initialAccountId }: { initialAccountId: string }) {
99const [profile, setProfile] = useState<Profile | null>(null);
100const [loading, setLoading] = useState(true);
168}
169170function getSocialLink(platform: string, username: string) {
171const links: Record<string, string> = {
172github: `https://github.com/${username}`,
179}
180181function getSocialIcon(platform: string) {
182const icons: Record<string, string> = {
183github: "📂",
190}
191192export function client(accountId: string) {
193createRoot(document.getElementById("root")).render(<App initialAccountId={accountId} />);
194}
195196export default async function server(request: Request): Promise<Response> {
197const url = new URL(request.url);
198const accountId = url.pathname.split("/").pop() || "efiz.near"; // Default to 'efiz.near' if no accountId is provided
falDemoAppmain.tsx3 matches
5import { falProxyRequest } from "https://esm.town/v/stevekrouse/falProxyRequest";
67function App() {
8const [prompt, setPrompt] = useState("");
9const [imageUrl, setImageUrl] = useState("");
103}
104105function client() {
106createRoot(document.getElementById("root")).render(<App />);
107}
108if (typeof document !== "undefined") { client(); }
109110export default async function server(req: Request): Promise<Response> {
111const url = new URL(req.url);
112if (url.pathname === "/") {