Overall purpose This function accepts two values, a and b, and returns the result of applying JavaScript’s + operator to them. It can perform numeric addition or string concatenation, depending on the argument types. Section-by-section walkthrough function add(a, b) declares a function named add with two parameters: a and b. { ... } contains the function body. return sends the computed value back to the caller. a + b applies the + operator to the two arguments. The final ; terminates the return statement. For example: add(2, 3); // 5…查看完整範例 →
AI 工作流程:開發
開發類別中可直接執行的 AI 工作流程:開啟一個,填寫簡短表單即可執行。每個工作流程都展示了它產生內容的範例以及單次執行的費用。
Findings Missing input validation / type confusion Severity: Low Line ref: 1 Exploit sketch: Calling add("1", "2") returns "12" because + performs string concatenation when either operand is a string. Fix: Declare numeric parameter and return types, validate values at runtime, and reject non-finite numbers. Injection Severity: None identified Line ref: N/A Exploit sketch: The function does not pass input to an interpreter, database, shell, HTML sink, or other injection-sensitive context.…查看完整範例 →
WITH customer_totals AS ( SELECT o.customer_id, SUM(o.total) AS total_order_value FROM orders AS o WHERE o.created_at = CURRENT_TIMESTAMP - INTERVAL '90' DAY GROUP BY o.customer_id ) SELECT c.id, c.name, ct.total_order_value FROM customer_totals AS ct JOIN customers AS c ON c.id = ct.customer_id ORDER BY ct.total_order_value DESC FETCH FIRST 10 ROWS ONLY; ```…查看完整範例 →
name: CI and Staging Deploy on: pull_request: push: branches: - dev Prevent older runs for the same branch or pull request from wasting resources. concurrency: group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true Use least-privilege defaults; individual jobs can add permissions if needed. permissions: contents: read env: NODE_VERSION: "22" PNPM_VERSION: "10" jobs: install: name: Install dependencies runs-on: ubuntu-latest steps: - name: Check out repository…查看完整範例 →
Rate Limiting Design 1. Algorithm Choice Use a hierarchical token bucket as the primary enforcement algorithm, supplemented by a short sliding-window burst detector. Why Token Bucket Token bucket is the best primary mechanism because it: Allows legitimate short bursts while enforcing a sustainable average rate. Requires constant memory and near-constant processing per bucket. Works efficiently in a distributed data store such as Redis. Supports different refill rates and capacities for each tier.…查看完整範例 →
Diagnosis The prompt “summarize this article” underperforms because it: Does not define the audience, purpose, or desired level of detail. Gives no criteria for identifying the article’s main point. Does not require supporting evidence, so summaries may become vague. Omits instructions for handling arguments, data, caveats, and conclusions. Specifies no output structure or length. Does not discourage generic framing, repetition, or unsupported interpretation. Rewritten Prompt — Version A: Thesis-First Summary Role…查看完整範例 →
Accessibility Audit Checklist — Checkout Form, Custom Dropdown, Modal Confirmation, Toast Notifications 1. Checkout Form 1.1 Errors are identified, described, and announced WCAG 2.2 criteria at risk: 3.3.1 Error Identification 3.3.3 Error Suggestion 3.3.7 Redundant Entry 4.1.3 Status Messages Keyboard test: Submit the form with required fields empty or invalid. Confirm focus moves to the first invalid field or to an error summary.…查看完整範例 →
Story 1: Export a report as PDF As a report user, I want to export a report as a PDF, so that I can save, print, or share a fixed-format version. Acceptance criteria Given I have permission to view a report, when I select “Export as PDF,” then the system generates a PDF containing the report’s current data and visible configuration. Given the PDF is generated successfully, when generation completes, then the file downloads with a meaningful name that includes the report name and export date.…查看完整範例 →
URL Shortener Architecture — Stress-Tested Revision 1. Stress-Test Findings Weak Point Category Failure or Cost Scenario Mitigation Central Snowflake-style ID Generator SPOF A single logical generator can block all automatic URL creation during failure, network partition, clock regression, or capacity exhaustion. Cross-region access also adds latency. Remove the network ID Generator. Generate random 128-bit values in each Management Service instance, encode 48–64 random bits as an eight-character Base62 code, and claim the code through a conditional…查看完整範例 →
RECOMMENDED fix(payments): retry webhooks and correct timeout handling Transient failures caused webhook events to be dropped too early. Retries improve delivery reliability, while proper timeouts prevent hangs. fix(webhooks): add retries and resolve payment timeout bug Payment callbacks could fail permanently during temporary outages. Retry logic and corrected timeouts make processing more resilient. fix(payment-webhook): handle retries and timeouts reliably Intermittent network issues could interrupt payment notifications.…查看完整範例 →
Likely planner behavior and bottlenecks Postgres will normally rewrite the IN subquery as a semi-join. A plausible plan is: Scan customers to find rows where country = 'TR'. Build a hash table of matching customer IDs. Scan all 20M rows of orders. Hash-join orders against the matching customers. Sort every matched order by created_at DESC. The planner is not necessarily making a semantic mistake; without suitable indexes, this may be the cheapest available plan. The expensive parts are likely: A sequential scan of orders.…查看完整範例 →
export function add(a: number, b: number): number { return a + b; } Notes: The TypeScript version explicitly accepts and returns number. Unlike the JavaScript original, calls with strings or other non-number values are rejected at compile time. TypeScript types are erased at runtime, so JavaScript callers can still pass incompatible values unless runtime validation is added. number includes floating-point values, NaN, and Infinity. JavaScript’s usual numeric behavior still applies, including floating-point precision issues and coercion at runtime.查看完整範例 →
依描述設計可上線的 JSON Schema:型別、限制、範例與驗證說明。
JSON Schema 設計
輸入: an e-commerce order with items, shipping address, payment status and timestamps
使用這個WebP Batch Batch-convert images to WebP from the command line with fast, consistent quality presets. <!-- Suggested badges: npm version, build status, test coverage, license, platform support --> Features Convert entire directories in one command Support for PNG, JPEG, TIFF, and other common image formats Built-in low, medium, high, and lossless quality presets Recursive directory processing Preserve source directory structure Skip unchanged or existing files Control output location, dimensions, and metadata Preview operations with dry-run mode…查看完整範例 →
Winner: canUserAccessDocument Reading-aloud test: “Can user access document?” Clear and natural. Implies: Returns a boolean after evaluating all relevant authorization factors. Mis-implies: May sound broader than role, ownership, and sharing settings if other access rules exist. hasDocumentAccess Reading-aloud test: “User has document access.” Concise and fluent at call sites. Implies: Checks whether the current or supplied user has access.…查看完整範例 →
觀看使用方式
How AI workflows work: one form in, a finished video out
A workflow is a ready-made recipe of AI steps. You pick a template, fill in a short form, and every step runs on its own until a finished video comes out. Here we follow one bedtime story video from the form to the result.
此影片為英文。
What happens when you press Run? The anatomy of an AI workflow
Let's open one workflow and look inside. A workflow is a graph: each box is a step, the arrows set the order, and steps that don't depend on each other run side by side. Your answers flow into the steps, some steps check their own work and run again, some wait for your approval, and every AI call is recorded with its own cost.
此影片為英文。