shirtGenScriptmain.tsx1 match
1export default async function server(request: Request): Promise<Response> {
2if (request.method !== "POST") {
3return new Response("Method Not Allowed", { status: 405 });
shirtGenScriptmain.tsx1 match
1export default async function server(request: Request): Promise<Response> {
2if (request.method !== "POST") {
3return new Response("Method Not Allowed", { status: 405 });
shirtGenScriptmain.tsx1 match
1export default async function server(request: Request): Promise<Response> {
2if (request.method !== "POST") {
3return new Response("Method Not Allowed", { status: 405 });
deftRedRoadrunnermain.tsx1 match
1import { OpenAI } from "https://esm.town/v/std/openai";
23export default async function(req: Request): Promise<Response> {
4if (req.method === "OPTIONS") {
5return new Response(null, {
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>,
handleDiscordNewUsermain.tsx2 matches
15}
1617async function detectTechnologies(email_address: string): Promise<ShovelResponse> {
18const domain = email_address.split("@")[1];
1940// # New Val Town User (on Clerk) -> Val Town Discord notification
41// Translates one kind of webhook (Clerk) into another (Discord)
42export async function handleDiscordNewUser(req: Request): Promise<Response> {
43// check custom auth secret sent from clerk
44if (req.headers.get("auth") !== Deno.env.get("clerkNonSensitive"))
giftSuggestionAppmain.tsx4 matches
9}
1011function App() {
12const [age, setAge] = useState<string[]>([]);
13const [budget, setBudget] = useState<string[]>([]);
201}
202203function client() {
204createRoot(document.getElementById("root")).render(<App />);
205}
209}
210211async function searchProduct(query: string): Promise<{ imageUrl: string; productUrl: string } | null> {
212try {
213// Using a more realistic product image placeholder
225}
226227export default async function server(req: Request): Promise<Response> {
228if (req.method === "POST") {
229const url = new URL(req.url);
sanguineCyanMastodonREADME.md11 matches
22stopwords: Contains a list of common stop words and web-specific terms to filter out during text analysis.
23synonyms: Dictionary mapping common words to their synonyms for highlighting in TF-IDF analysis.
24Functions
25The primary functions perform specific text analysis tasks, as detailed in the following sections.
2627Function Documentation
28Each function's purpose, parameters, and output are described below, along with notes on how they are used within the application.
2930analyseSentiment(text)
7273url (string): URL to fetch and clean content from. Returns: Cleaned text string or an error message.
74Usage: This function powers the URL input functionality.
75Core Functionalities
76Text Analysis Form (HTML)
77The form on the main page allows users to submit either raw text or a URL. The client-side JavaScript processes the form submission and, if needed, triggers a URL fetch to obtain content.
9192Integration Tests: Ensure calculateTFIDF, calculateWordFrequency, and fetchUrlContent produce consistent outputs.
93Client-Side Testing: Regularly test URL fetching functionality to ensure robustness, particularly with dynamic sites.
94Error Handling
9596Maintain try/catch blocks in asynchronous functions like fetchUrlContent to capture network issues.
97Update error messages to be user-friendly and provide feedback if inputs are invalid or exceed size limits.
98Data Sanitization
115Multilingual Support
116117Extend stop words, sentiment analysis, and cleaning functions to support languages beyond English.
118119The Radical Text Analyser code primarily uses the following APIs:
1232. External Content Fetching API (via fetch)
124* Purpose: Retrieves HTML content from external URLs when users input a URL for analysis.
125* Usage: The fetchUrlContent function uses fetch to make a GET request to the user-provided URL, which allows the application to process content from web pages.
126* Error Handling: Includes logic to check response status and handle various network errors.
1273. Google Fonts API
132* Usage: Loaded in the HTML <head> section with <script src="https://cdnjs.cloudflare.com/ajax/libs/jqcloud/1.0.4/jqcloud-1.0.4.min.js"></script> and <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqcloud/1.0.4/jqcloud.min.css">
133134The TF-IDF analysis in this code is performed without using an external library. Instead, it’s implemented directly in the `calculateTFIDF` function. Here’s how it works:
1351361. **Tokenization and Filtering**: The text is split into words and phrases, excluding stopwords and web-specific terms.
twitterAlertmain.tsx1 match
4const query = "\"samwho.dev\" -is:retweet -from:samwhoo";
56export async function twitterAlert({ lastRunAt }: Interval) {
7// search
8const since = lastRunAt ? Math.floor(lastRunAt.getTime() / 1000) : 0;
scraper_templateREADME.md1 match
133. Adjust the if statement to detect changes and update your blob
14154. Craft a message to be sent with `sendNotification()` function