ToCode
Kanalga Telegramโda oโtish
ืืืคืื ืงืฆืจืื ืืืชืื ืชืื ืืืช ืื ืื ืคืจืง
Ko'proq ko'rsatish1 419
Obunachilar
-124 soatlar
Ma'lumot yo'q7 kunlar
-430 kunlar
Postlar arxiv
1 419
ืื ืขืืื ืืื ืืืืกืจืื ืืื ืืื ืฉืืื ืื ื ืฉืืืื ืขื ืชืืืจืืช ืขืืืื ืืฉืจืช. ืื ืื ื ืืืฉืคืขืื ืืืฉืื ืืืื ื name ืื time.
ืืคืฉืจืืช ืฉื ืื ืืื ืืฉืืืจ ืืช ืืื ืืืืืืจ ืืืืื ืืช name ืืืืฅ ืืงืืืคืื ื ืืืช ืืืืชืื ืืช ืื ืงืื ืขืืืื ืืฉืจืช ืืืงืื ืืืจ. ืืืช ืืืืฉื ืฉืืืงืืช react-query. ืืงืื ืืืืื ืืื ื ืจืื ืื (ื ืืชื ืขื ืืื ChatGPT):
import { useEffect, useState } from "react";
import { useQuery } from "@tanstack/react-query";
import { sendOnlineTime } from "./api";
type Props = {
name: string;
};
export function UserOnlineTimer({ name }: Props) {
const [time, setTime] = useState(0);
// Local timer (increments every second)
useEffect(() => {
const interval = setInterval(() => {
setTime((t) => t + 1);
}, 1000);
return () => clearInterval(interval);
}, []);
// React Query handles the polling request
useQuery({
queryKey: ["user-online", name, time],
queryFn: () => sendOnlineTime(name, time),
enabled: time > 0,
refetchInterval: 1000,
refetchIntervalInBackground: true,
});
return <p>User {name} is online for {time} seconds</p>;
}
ืืคืขื ืื ืืื ื ืืื ืืืคืืื ืืช ืืงืจืืื ื useQuery ืืคืฉืจ ืืืืฆืื ื Custom Hook ืื ืฉืขืื ืืืชืจ ืืงื ืขืืื ื ืืคืืชืื ืงืืืคืื ื ืืืช "ืืืืืืืช" ืืืืฉื.
ืื ืืื useEffectEvent ืฉืืื ืืช ืืืกืฃ? ืงืฉื ืืืืื. ืืฆื ืืื ืืื ืคืืชืจ ืืขืื ืืืืชืืช ืฉืืืชื ืขื Hooks ืื ืืชื ืคืชื ืืืืื ืืืืชื ืืื ืฉื ืชืงืข ืขื ืืคืงื ืฉืฆืจืื ืืงืจืื ืืืืข ืืกืืืื. ืืฆื ืฉื ื ืืืื ืืื ืฉืื ืื ื ืืื ืื ืืคืืืงืฆืืืช ืจืืืงื ืืืื ืืืช ืื ืืขืื ื ืคืืฆื ืืื ืฉืืืื ื ืืืืืื ืื ืฉืชืืื.
ืื ืืขืชืื? ืืชื ื ืชืงืืชื ื Stale Data ืืืคืงื? ืืื useEffectEvent ืชืขืืืจ ืืื?1 419
ืื ืขืืฉื useEffectEvent ืืจืืืงื ืืืชื ืขืืื ื ืืืฉืชืืฉ ืื
ืจืืืงื 19.2 ืืืกืืคื ืคืื ืงืฆืื ืืืฉื ืืื ืืืคื ืืืงืจื ืงืืืกื ืืื ืืขืฆืื ืฉื ืงืื ืืคืงื ืื ืืขืืืื. ืืคืืกื ืื ื ืจืื ืืงืฆืจื ืืช ืืืื, ื ืจืื ืืื useEffectEvent ืขืืืจ ืืืชืืืื ืืชื ืื ืฉืื ืื ืืืื ืืืช ืืขืื ืืืืชืืช.
ืงืื ืกืืืจืืจ - ืืื ืืื ืื ื ืืืืืจ
ืืงืื ืืื ืืฆืื ืฉืืจืช ืืงืกื ืขื ืืืกื ืฉืืจืื ืืื ืืื ืืฉืชืืฉ ืืกืืื ืืืืืจ. ืื ืฉื ืื ืืขืืื ืืช time ื-1 ืืืืคืกืื ืืฉืฉื ืืืฉืชืืฉ ืืชืขืืื. ืขื ืคื ืืื ืจืืืงืื ืืืคื:
import { useState, useEffect, useEffectEvent } from 'react'
import './App.css'
function EffectEventDemo({name}: {name: string}) {
const [time, setTime] = useState(0);
useEffect(() => {
const ivl = setInterval(() => {
setTime(c => c + 1)
}, 1000);
return () => clearInterval(ivl);
}, [name]);
return <p>User {name} is online for {time} seconds</p>
}
function App() {
return (
<EffectEventDemo name='demo' />
)
}
export default App
ืขืืฉืื ื ืืืืื ืขืืืื ืงืื ืฆื ืฉืจืช
ืืกืืคืืจ ืืชืืื ืืืชืืืื ืื ื ืืืืื ืฉืืืงืื ืจืง ืืืขืืืช ืืช ืืืืืืจ ืื ืื ื ืจืืฆืื ืื ืืขืืื ืงืื ืฆื ืฉืจืช, ืืืฉื ืืฉืืื ืืฉืืืจ ืกืืืืกืืืงื ืฉื ืืื ืืื ืื ืืฉืชืืฉ ื ืืฆื ืืืชืจ ืฉืื ื. ืืฉืืื ืื ืืืื ื ืจืฆื ืืืชืื ืืช ืืงืื ืืื:
function EffectEventDemo({name}: {name: string}) {
const [time, setTime] = useState(0);
useEffect(() => {
const ivl = setInterval(() => {
fetch(\/ping\, {
method: 'POST',
contentType: 'application/json',
body: JSON.stringify({
name,
time,
}),
});
setTime(c => c + 1)
}, 1000);
return () => clearInterval(ivl);
}, [name]);
return <p>User {name} is online for {time} seconds</p>
}
ืืื ืืชืืชื ืจืืืงื ืืืชืจ ืืืื ืืืื ืืืื ืื ืขืฉืืชื ืงืืจืก ืจืืืงื ืฉืคื ืืืชืจ ืืืื ืืชื ืจืืืื ืฉืื ืื ืขืืื. ืืืืจ ืืืืคืงื ืื ืชืืื ื time ืคืื ืงืฆืืืช setInterval ื ืงืจืื ืจืง ืคืขื ืืืช ืืฉืืงืืืคืื ื ืื ื ืื ืกื ืืืกื. ืืคืื ืงืฆืื ืืคื ืืืืช ืืืชื ืืขืืจื ื ื setInterval ืืืืจืืืช ืขื ืขืืืื ืืฉืขืื ืืฉืืืืช ืืืืืขื ืืฉืจืช ื ืืฆืจื ืคืขื ืืืช ืืขืช ืืฆืืจืช ืืงืืืคืื ื ืื ืืืืฉืชื ื time ืฉืืชืื ืืคืื ืงืฆืื ืื ืฆื ืืฉืืืจ ืขื ืขืจืื. ืืชืืฆืื ืืื ืฉืืืืช ืืืืขืืช ืืฉืจืช ืืื name ืืื ืืื ืฉื ืืืฉืชืืฉ ืืื time ืืื ืชืืื 0.
ืคืชืจืื ืขื useEffectEvent
ืชืฉืืื ืืฉืืืข ืฉืืื ืืืจืกื 19.2 ืฉื ืจืืืงื ืชืืืื ืืคืชืืจ ืืช ืื ืืฆืืจื ืืืื ืคืฉืืื ืขื ืคืื ืงืฆืื ืืืฉื ืืฉื useEffectEvent. ืคืื ืงืฆืื ืื ืืงืืืช "ืคืื ืงืฆืืื ืคื ืืืืช" ืฉืื ืื ื ืืืืจืื ืืืชืื ืืชืื effect ืืืขืืื ืืืชื ืื ืฉืืื ืื ืชืืชืงืข ืขื ืขืจืืื ืฉื ืืฉืชื ืื ืืชืืื ืชืงืจื ืืช ืืขืจื ืืขืืื ื ืฉื ืืฉืชื ื ืืกืืืื ืื ืืคืจืืคืก ืืื ืืื ืชืืืื. ืืงืืฆืืจ ืืงืื ืืื ืขืืื ืืืฉ ืืืื ืืฉืืื ืืฉืจืช ืื ืฉื ืื ืืืืขื ืขื ืฉื ืืืฉืชืืฉ ืืืกืคืจ ืืฉื ืืืช ืืืืืชื ืฉืืืฉืชืืฉ ืืืืืจ:
function EffectEventDemo({name}: {name: string}) {
const [time, setTime] = useState(0);
const notifyServer = useEffectEvent(() => {
fetch(\/ping\, {
method: 'POST',
contentType: 'application/json',
body: JSON.stringify({
name,
time,
}),
});
});
useEffect(() => {
const ivl = setInterval(() => {
notifyServer();
setTime(c => c + 1)
}, 1000);
return () => clearInterval(ivl);
}, [name]);
return <p>User {name} is online for {time} seconds</p>
}
ืืืืงื ืืืืจ ืืคืชืจืื ืืคืฉืื ืืื ืืขื ืืื ืืืืืืจ ืื ืขืฉืื ื ืืคื ื useEffectEvent ืืื ืืืื ืืืชื ื ืืคืชืจืื ืขื ืืืืคื ืฉื ืจืืืงื. ืื ืืคื ื useEffectEvent ืคืื ืงืฆืืืช ืขืืืื ืืฉืจืช ืืืชื ืฆืจืืื ืืจื ืืืฉืช ื time, ืืื ืขืืืื ืื ืืืื ืืืืืช ืืืืืจืช "ืืื" ืขื ืืฉืื ืืืื ืื.
ืคืชืจืื ืืื ืืื ืืื ืืช ืืคืงื ื ืืกืฃ ืฉืืืื ืชืืื ื time ืืืงืื ืืขืืื ืืช ืฉื ืืื ืืืืชื Callback. ืื ืคืขื ืฉ time ืืฉืชื ื ืืืคืขื ืืคืงื ืขืืืื ืืฉืจืช. ืื ืืื ื ืจืื ืื:
function EffectEventDemo({name}: {name: string}) {
const [time, setTime] = useState(0);
useEffect(() => {
fetch(\/ping\, {
method: 'POST',
contentType: 'application/json',
body: JSON.stringify({
name,
time,
}),
});
}, [time, name]);
useEffect(() => {
const ivl = setInterval(() => {
notifyServer();
setTime(c => c + 1)
}, 1000);
return () => clearInterval(ivl);
}, [name]);
return <p>User {name} is online for {time} seconds</p>
}1 419
tools: ['vscode', 'read', 'search', 'web', 'agent', 'todo'] --- As a "Code Reviewer" agent, your primary function is to meticulously examine provided code snippets or files. Focus on identifying potential bugs, security vulnerabilities, adherence to project coding standards, and overall code quality. Provide actionable feedback and suggest improvements as comments directly in the code or a concise list of recommendations. You must be thorough. As a "Code Reviewer" agent, your primary function is to meticulously examine provided code. MANDATORY PROCESS: 1. Use a sub agent to run the tests with "npm run test" 2. Perform static code review If tests cannot be run, explicitly state why.ืฉืืื ืื ืืฉืืจื:
1. Use a sub agent to run the tests with "npm run test"
ืืื ืื ืืกืืื ืืฆืื ืฉืืืืื ืื ืืืจืืฅ ื Subagent. ืื ืื ื ืืืืืื ืจืง ืืืงืฉ. ืืื ืืฉืื ืืฆืืื ืืืื ืืจืืฅ ืืช ืืืืืงืืช ื Subagent ืื ืืคืื ืฉื ืืืืืงืืช ืื ืืืืื ืืช ื Context Window ืืืฉืืืจ ืืช ืืกืืื ืืืืงื ืืงืื. ืื ืืื ืืคืื ืฉืืืคืืข ืืฉืืื:
Since I don't have terminal access to run git commands directly, let me check if there are any staged or unstaged changes first, and also look at the workspace to understand what might have changed recently.
Actually, let me start by:
Running the test suite via subagent (as required)
Then look at what files might be the focus of the latest work
Let me proceed with the mandatory process.
ืืืชืจืื ืืืื ื ืื ืืื ืฉืื ื ืื ืืืื ืืชืช ืืกืืื ื Code Review ืืช ืืื ืืืจืืื ื ืืื ื ืืืื ืืืคืจืื ืืืืคืขืื ืื ืกืืื ืขื ืืืืื ืฉืจืืืื ืืื ืื.
ืืชืงื ืช ืฉืืจืืชื MCP
ืืืืืื ืจ ืื ืืกืคืงื ื ืืืืจ ืขื MCP ืืื ืื ื ืื ืจืืฆื ืืืขืช ืืื ืืกืืืื. ืืคืจืืืงื ืื ื ืืืื ืืืฆืืจ ืชืืงืื ืืฉื .vscode ืืืชืืื ืงืืืฅ ืืฉื mcp.json ืฉืืืื ืืช ืืืืจืืช ืฉืจืชื ื MCP ืฉื ืืคืจืืืงื ืืกืคืฆืืคื. ืืคืฉืจ ืืืืืข ืืงืืืฅ ืืื ืืชืื Ctrl-Shift-P ืืืืืืจ Open Workspace Folder MCP Configuration.
ืืืืจืช ืฉืจืชื MCP ืืืจืฉืช ืงืฆืช ืืืชืจ ืืืฉืื ืขื ืืืจืืื ืืืืคื ืืขืืืื ืฉืื ื ืขื ืื ืฉืื ืืืจืื:
1. ืฉืจืช MCP ืฉืืืืืจ ืืคืจืืืืงืื stdio ืืืจืฉ ืฉืืชืืื ืืช ืขืฆืื ืชืืื ืืืชืงื ืช ืื ืขื ืืืืฉื. ืืฉืื ื ืืืืืจ ืืช ืืงืืืฅ ืืืืืจืืช ืืคืจืืืงื ืื ื ืืืจืฉ ืฉืื ืื ืฉืขืืื ืืืชื ืขื ืืคืจืืืงื ืืชืงืื ืืช ื MCP ืืื.
2. ืฉืจืช MCP ืฉืืืืืจ ืืคืจืืืืงืื http ืืืชืจ ืืืืฉ ืืืขืืื ืืื ืื ืฉืืคืชื ืืช ืืคืจืืืงื.
ืืืืืื ืื ืื ื ืจืืฆื ืืืืกืืฃ ืืช ืฉืจืช ื MCP ืฉื ืืืืืื ืืื ืฉืืคืฉืจ ืืืื ืืชืื VS Code ืืืกืชืื ืขื Issues ืืืืฆืข ืคืขืืืืช ืืฉืืจืืช ืืืืืืื ืื ื ืืืชืื ืืงืืืฅ:
{
"servers": {
"github": {
"type": "http",
"url": "https://api.githubcopilot.com/mcp/"
}
}
}
ืืคืจืืืงืืื ืืืืืื ืื ื ืืืื ืืืฉืชืืฉ ื MCP ืืฉืืืื ืขื ืกืืื ืื ืืืชืืืื ืืืฉืืช ืืื ืืฉืืื ืืืืื ืืืื ืกืืื ืืืื ืืืคืขืื ืืืคืืื ืืืชืื ืืืื ืกืคืฆืืคืืื ืขืืืจ ืืืชื ืคืจืืืงื ืืกืืื ืื ืกืคืฆืืคืืื ืฉืืฉืชืืฉื ืืืืื ืืื.
ืฉืื ืชืืื ืืื ืื ืฉืืื ืืืืืื ืจ ืืงืืื ืฉื ืื ืืชื ืืืืืชื ืืชืืื ืืืืืืช ืืืื ืืื ืฉืืฉืชืชืคืื, ืืืืจืื ืืฉืืืืื - ืื ืื ืฉืืืคื ืืช ืืืคืืฉืื ืืืืืืืื ืืจืืืื ืืื. ืฉืืืข ืืื ื ืคืืฉ ืืืืจ ืขื ืืื ืืืืื ืื ืืฉืคืจ ืืืืื ืืช ืคืืชืื ืืกืืื ื ืงืืืื ืืื ืืืื ืฆืจืื ืืืืื.1 419
* Provide a refactored version of the code that fixes identified issues while maintaining the API signature (if possible).ืงืืฆื Instructions ืื ืืฉ ืชืืื ืฉืืฉืืชืฃ ืืืื ืคืจืืืคืืื ืืืชื ืจืืฆืื ืืืชืื ืืืชื ืชืืื ืืฉืคืื ืื ื AI ืขืืืจ ืงืืฆืื ืืกืืืืื ืื ืงืืฆืื ืืคืจืืืงื ืืกืืื ืชืืืื ืืืฆืืจ ืงืืืฅ instructions: 1. ืืืืฆืื Ctrl+Shift+P ืืืืืจืื Chat: New instructions file 2. ืืืืจืื ืืืคื ืืฉืืืจ ืืช ืืงืืืฅ - ืืฆืืื ืืืฉืชืืฉ ืื ืืคืจืืืงื. 3. ืืืืจืื ืฉื ืืงืืืฅ. 4. ืืงืืืืื ืืช ืืืืจืืืช ืืฉืืืจืื. ืงืืฆื ืืืืจืืืช ื ืฉืืจืื ืืชืืงืืืช
instructions ืขื ืกืืืืช .instructions.md. ืืืืืื ืจ ืจืืื ื ืืืืื ืืงืืืฅ ืืืจืืืช ืืคืจืืืงื C:
---
applyTo: '*.*'
---
Act as a Senior C Systems Engineer and Security Researcher. You're working on a mission-critical library used by many external clients. Reliability, security (memory safety), and high performance are paramount.
ืืชืืืช ืกืืื ืื
ื VS Code ืืฉ 4 ืกืืื ืื ืืืื ืื: Agent, Ask, Edit ื Plan. ืกืืื ืืื ืืืืืจ ืืื ืงืืืฅ ืืืจืืืช ืืจืฉืืืช ืืืื ืฉืืื ืืืื ืืืคืขืื - ืืื ืื ื ืืืืืื ืืืฆืืจ ืกืืื ืื ืืืฉืื ืืืฉืืืืช ืกืคืฆืืคืืืช. ืืืืืื ืืืื ืื ื ืืืชืื ืกืืื ืฉืืืืข ืืขืฉืืช Code Review ืืืืื ืืืจ ืืช ืชืืืื ืืขืืืื ืืืืจืฉืืืช ืืกืคืฆืืคืืืช ืื ืืจืฉืืช ืืืืฆืืข Code Review.
ืืฉืืื ืืืฆืืจ ืงืืืฅ ืกืืื ืืืฉ ืื ื ืืืืจ ืืชืคืจืื ื Ctrl+Shift+P ืืืืคืฆืื New Custom Agent, ืฉืื ืืืืจ ืืฉืืืื ืืืงืื ืืืืชื ืืช ืืชืืื ืืงืืืฅ. ืืกืืื ืืฉ ืื ืืืจืืืช ืืื ืจืฉืืื ืฉื ืืืื ืืืกื ืืขืจืืื ืฉื VS Code ืืืื ืชืืืช ืืืืจื ืืื ืืืืืจ ืืช ืืืืื. ืืงืืืฅ ืขืฆืื ื ืฉืืจ ืืชืืงืืืช github/agents ืืคืจืืืงื ืขื ืืกืืืืช .agent.md. ืื ืืืืื ืฉืจืืื ื ืืงืืืฅ ืกืืื ืฉืขืืฉื Code Review:
---
name: Code Reviewer
description: An agent that reviews code for quality, style, security, and best practices.
tools: ['vscode', 'read', 'search', 'web', 'agent', 'todo', 'execute']
---
As a "Code Reviewer" agent, your primary function is to meticulously examine provided code snippets or files. Focus on identifying potential bugs, security vulnerabilities, adherence to project coding standards, and overall code quality. Provide actionable feedback and suggest improvements as comments directly in the code or a concise list of recommendations. You must be thorough.
As a "Code Reviewer" agent, your primary function is to meticulously examine provided code.
MANDATORY PROCESS:
1. Run the tests with "npm run test"
2. Perform static code review
If tests cannot be run, explicitly state why.
ืืื ืืื ืกืืื ืฉืืืืข ืจืง ืืืจืืฅ ืืช ืืืืืงืืช:
---
name: Test Runner
description: A subagent responsible for executing the Vitest test suite, analyzing failures, detecting flaky tests, and flagging potential performance regressions.
tools: ['execute']
---
As a Test Runner agent, your task is to run the project's Vitest test suite
and report results back to the invoking agent.
Responsibilities:
- Execute Vitest with "npm run test"
- Summarize failures with likely causes
- Identify slow or flaky tests
- Call out tests that may mask performance issues
- Do NOT modify code unless explicitly asked
Output should be concise, structured, and suitable for inclusion in a
code review.
ืืืจื ืฉืื ื ืืืฆืจ ืืช ืืกืืื ืื ืืืืชืืืื ืืืฉืืช ืื ื ืืืื ืืืคืขืื ืืืชื ืืืืื ืืฆ'ืื ืืืืฆืขืืช ืฉืื ืื ืืกืืื ืืคืขืื ืืืชื ืชืจืื ืืืชื ืืชืืช ื-4 ืืกืืื ืื ืืืืื ืื ื VS Code.
ืืจืฆืช Sub Agents
ืืคืขืืื ื ืจืฆื ืืืงืฉ ืืืกืืื ืืขืฉืืช ืืฉืื ืืื ืืืื ืืช ืืงืื ืืงืกื ืืื ืืชืืื ืฉื ืื ืฉืืืฆืข ืืืขืฆื ืืืกืชืื ืจืง ืขื ืืชืืฆืื ืฉื ืชืืืื ืืจืื. ืื ืื ืื ืืื ื ืงืจื Sub Agents ืืืืืืื ืจ ืขืฆืื ืงืฆืช ืืกืชืืืชื ืืืชื. ื ืืกืืชื ืืืฆืืจ ืกืืื Code Review ืฉืืคืขืื ืืชืืจ Sub Agent ืกืืื ืืืจ ืฉื Test Runner. ืืืืืชื ืืืจื ืืืืืื ืจ ืฉืืฉืืื ืืขืฉืืช ืืช ืื ืฆืจืื ืืืคืขืื ืืืืืจืืช ื VS Code ืืช ืืืืคืฆืื Custom Agent In Subagent. ืืืจื ืืคืขืืช ืืืืคืฆืื ืืื ืืืฆืืื ื VS Code ืืืคืขืื ืืืืฉ ืืฆืืืชื ืืืคืขืื ืกืืื ืฉื Code Review ืฉืืคืขืื Sub Agent ืฉื Test Runner.
ืืฉืืื ืืืคืขืื ืืฉืืื ืืกืืืืช ืืชืืจ Sub agent ืขืืื ื ืืืงืฉ ืืช ืื ืืืกืืื ืืงืืืฅ ืืืืจืืืช. ืืืืืื ืืืื ืื ื ืืืงืฉ ืืกืืื ื Code Review ืืืฆืข ืืช ืืจืฆืช ืืืืืงืืช ืืชืืจ ืกืืื ืฆืืื:
---
name: Code Reviewer
description: An agent that reviews code for quality, style, security, and best practices.1 419
ืกืืืื ืืืืื ืจ - ืืืคืื ืืขืืืื ื VS Code
ืืืืืื ืจ ืฉืืชืงืืื ืืฉืืืข ืืืื ืืืืฉื ืคืชืื ื ืืช VS Code ืืจืฆืื ื ืืืืื ืืื ืืฉืคืจ ืืช ืืขืืืื ืขื ืงืืคืืืืื ืืจืื ืืืืฉ ืขื ืขืืืื ืืฆืืืช. ืื ื ืืกืื ืืื ืืช ืืืืจืื ืืืจืืืืื ืฉืืฆืืชื ืืืืืช ืืื ืฉืืื ืืื ืืื ืฉืื ืืฆืืืื ืืืืืข.
ืงืืฆื ืคืจืืืคื
ืคืจืืืคื ืื ืืืืจ ืฉืื ืื ื ืืืชืืื ื AI. ืื ืืฉื ื ืืื ืื ืื ื ืืืืื ืืกืืฃ ืืชืฉืืื ืฉื ื AI ืืื ืชืืฆืื ืฉื ืืคืจืืืคื ืฉืืชืื ื ืืื ืขื ืืงืื ืืคืจืืืงื. ืืืื ืืื ื ืืื ืื ื AI ืืื ืืฆืื ืื ื "ืฆืืื" ืืคืจืืืคื ืืืจื ืื ืืืืขื ืฉืื ืื ื ืฉืืืืื ืืื ืืื ืชืืื ืื ืื ืงืืจื ืืงืฉื ืืคืขืืื ืืืขืช ืื ืืชืฉืืื ืฉืงืืืื ื ืืื ืืืืช ืืืืื ืืืืชืจ ืฉืืฉ ืื ืฉืืคืฉืจ ืืฉืคืจ ืืืชื ืขื ื ืืกืื ืืืจ.
ืืคืชืืื ืฉืจืืฆืื ืืขืืื ืืื ืขื AI ืืืืขืื ืื ืกืืช ืืื ืคืจืืืคืืื ืืื ืืขืื ืืืจืื ืคืขืืื ืื ืืคืชืื ืฉืืืืช ืืืฉืืช ืจืง ืืฉืืื ืื ืกืืช ืคืจืืืคื ืืื ืฉืืืฉืคืข ืืชืืืืช ืืฉืืื. ืืคืฉืจ ืื ืืคื ืืช ื AI ืืืืงืฉ ืฉืืขืืืจ ืื ื ืืฉืคืจ ืืช ืืคืจืืืคื. ืืืืจื ืืื ืื ืกืืื ืืช ืื ืื ื ืืืืื ืืื ืืื ืืงืืช ืฉืขืืืืืช:
1. ืคืจืืืคืืื ืขืืืืื ืืื ืืืชืจ ืืฉืื ืืฆืืื ืื ืืืืจืืจ ืื ืืืืจื ืืื ืชืคืงืื ืืกืืื ืืกืืคืืจ - ืืืื ืกืื ืฉื code review ืืชื ืจืืฆื? ืื ืงืื ืฉืืืฉืื ืืืจ ืขืืจ ืืืื ืืจืง ืฆืจืื ืืืืื ืฉืื ืคืกืคืกื ื ืืืื? ืืืช ืกืงืืจื ืจืืฉืื ื? ืื ืื ื ืืกืชืืืื ืขื ืกืงืจืืคื ืฉืจืฅ ืคืขื ืืืืืฉ ืืืืื ื ืืฆื ืื ืงืื ืฉืขืื ื ืืืืคื ืืงืฉืืช ืืฉื ืื? ืงืื ืืงืกื ืืืืื ืืช ืืกืืื ืืชืฉืืื ืฉืื ืื ื ืจืืฆืื.
2. ืคืจืืืคืืื ืขืืืืื ืืื ืืืชืจ ืืฉืื ืืฆืืื ืื ืืื ืืืฆืื ืืช ืืชืืฆืื - ืืชื ืจืืฆืื ืืงืื ืืืืืช ืงืื? ืืชืืจ ืชืจืืืฉ ืฉืื ืงืื ืืกืืื ืืืฉืืจ? ืืืชืื ืืกืื ืืืืงืืช?
ืืขืืืื ืขื AI ืื ืื ื ืืืืืื ืืืืืช ืคืจืืืคืืื ืฉืืืืจืื ืขื ืขืฆืื ืืืืืื:
1. ืชืจืืฅ Code Review ืขื ืืงืืืื ืืืืจืื.
2. ืชืกืืืจ ืื ืขืืฉื ืคืื ืงืฆืื.
3. ืชืืชืื ืชืืื ืืช ืืืืงืืช ืืคืื ืงืฆืื.
4. ืชืืื ืื ืืืกืืื ืืงืื ืฉืืืจื ืืืื ืืคื ืชืืืืจ ืฉืืืืข ืืืชืืืื.
5. ื ืชืื ื ืืืืงื ืฉื ืืฉืืช, ืชืกืืืจ ืืื ืืื ื ืืฉืืช ืืชืชืงื ืืืชื.
6. ืชืขืฉื Refactor ืืื ืื ืงืืช ืงืื ืืคืื.
ืื ืืื ืืืกืขืืคืื ืคื ืืืื ืืชืช ืชืืฆืื ืืฉืืขืืชืืช ืืืชืจ ืืืื ืืื ืฉืืคืจืืืคื ืืืื ืืื ืืืชืจ ืืื ืืื ืฉืื ืื ื ืืคืขืืืื ืืฉืื ืืืชืจ ืคืขืืื ืื ืื ืื ื ืืชืขืืืคืื ืืืชืื ืืช ืืคืจืืืคื ืืืื. ืื ืขืืฉืื? ื VS Code ืืคืฉืจ ืืืฆืืจ ืงืืืฅ ืคืจืืืคื:
1. ืืืืฆืื Ctrl+Shift+P ืืืืืจืื Chat: New prompt file
2. ืืืืจืื ืื ืืฉืืืจ ืืช ืงืืืฅ ืืคืจืืืคื ืืชืื ืชืืงืืืช ืืคืจืืืงื ืื ื User Data. ืฉืืืจืช ืคืจืืืคื ื User Data ืชืืคืฉืจ ืืืฉืช ืืืื ืืื ืคืจืืืงื ืฉืชืคืชืื ืืืืืฉื ืฉืืื, ืฉืืืจืช ืืคืจืืืคื ืืชืืงืืืช ืืคืจืืืงื ืชืืคืฉืจ ืืื ืืืืกืืฃ ืืช ืืคืจืืืคื ืืืื ืืื ืืื ืืืื ืืืื ืืื ืืืคืชืืื ืืืืจืื ืฉืขืืืืื ืืชืื ืขื ืืคืจืืืงื. ืืช ืจืื ืืคืจืืืคืืื ืืืื ืืฉืืืจ ืืชืืงืืืช ืืคืจืืืงื.
3. ืืืืจืื ืฉื ืืงืืืฅ ืืคืจืืืคื.
4. ืืืชืืื ืืช ืืคืจืืืคื ืืงืืืฅ ืืฉืืืจืื.
ืืคืจืืืคืืื ื ืฉืืจืื ืืชืืงืืืช
github/prompts ืขื ืกืืืืช .prompt.md. ืืืจื ืฉืืฆืจืชื ืงืืืฅ ืคืจืืืคื ืืชื ืืืืืื ืืืคืขืื ืืืชื ืืชืื ืืฆ'ืื ืืืืฆืขืืช ืืชืืืช / ืืื ืฉื ืงืืืฅ ืืคืจืืืคื (ืื ืฆืจืื ืืช ืื ืืฉื ืืฉ ืืฉืืื ืืืืืืืืช).
ืื ืืืืื ืฉืจืืื ื ืืคืจืืืคื ืฉืืกืืืจ ืคืื ืงืฆืื ืืชืืื ืืช c ืืคืจืืืงื libuv:
---
agent: agent
---
Please analyze the code below and provide a report with the following sections:
* 1. Functional Analysis *
* **Input Arguments:** detailed breakdown of types, expected ranges, and **ownership semantics** (who frees the memory?). Check for \const\ correctness.
* **Return Values:** Explain all possible return states, including specific error codes, \NULL\ pointers, or \errno\ implications.
* **Intended Use Case:** Infer who calls this function and why, based on the logic (e.g., is it a hot-path utility, a setup function, a blocking I/O call?).
* 2. Critical Code Review (The "Roast") *
* **Edge Cases & Validation:** Does the function handle \NULL\ pointers, zero-length buffers, or integer overflows?
* **Undefined Behavior (UB):** Identify any potential UB (e.g., signed overflows, uninitialized memory, strict aliasing violations).
* **Security:** specific checks for buffer overflows, use-after-free, double-free, or information leaks.
* 3. Performance & Resources *
* **Complexity:** Time and Space complexity (Big O).
* **System Impact:** specific analysis of heap allocations (\malloc\), blocking system calls, or cache locality issues.
* **Concurrency:** Is this function thread-safe? Is it reentrant?
* 4. Refactoring Suggestions *1 419
ืืืืงืืช ืื ืฉืคื
ืืืืง ืืื ืืฉืื ืืืชืืืช ืืืืงืืช ืืื ืื ืืชืืืช ืืืืืงืืช ืขืฆืื ืืื ืื ืืืช ืืชืฉืชืืช ืืืชื ืื ืื ื ืืืชืืื ืืช ืืืืืงืืช. ื ืฉืืื ืืื ืฉืชื ืืคืฉืจืืืืช ืืืชืืืช ืืืืงืืช ืืืืืืืืืช ืืืชืจ:
1. ืืคืฉืจืืช ืจืืฉืื ื ืืืืืงื ืชืืื "ืื ืก ืืืฃ ืืืืช, ืืืฅ ืขื ืชืืืช ืืืงืกื ืืืืฆืข, ืชืืชืื ืืืืช ืืืคืืฉ, ืืืฅ ืืืฉืืจ, ืืขืืื ืฉืืชืงืื ืชืืคืฉ ืจืฉืืืช ืคืจืืืื ืืชืจืื ืฉืืคืจืื ืืจืืฉืื ืืฉ ืืช ืืืงืกื X.
2. ืืคืฉืจืืช ืฉื ืื ืืืืืงื ืชืืื "ืฆืืจ ืืืงื ืขื ืฉืืืฉื ืืคืื X, Y ื Z. ืืคืฉ X. ืชืจืื ืฉืืชืืฆืื ืืจืืฉืื ื ืืื X."
ืืขืืจ ืืืืชืจ ืฉืืืื ืืืชืจืื ืืื ืืืื ืฉื ืืืืฉื ืืฉื ืื ืืื ืงืืืขืช ืืืืืื. ืืืืจืช ืืืืืืืช ืฉื ืืืขืจืืช. ืืืขืจืืช ืฉืื ืืืืขืช ืืื ืืช ืืืงื. ืืื ืืืืขืช ืืืคืฉ ืืืื ืืืืขืช ืืืฆืื ืชืืฆืืืช. ืืืืฉื ืืฉื ืื ืืืขืื ื ืืช ืืืืืงื ืืืฉืืขืืช, ืืืื ืืืจืฉืช ืืฉืืื, ืืื ื ืืืชืืืช ืชืฉืชืืช (ืืืจื ืืื ืืชืื ืืช ืฉื ืงืจืืช Page Object Model9).
ืืืืงืืช ืื ืฉืคื. ืืฉืคื ืืืื ืืืจืืืช ืืื ืืชืงืฉืจ ืืฉืืขืืช. ืืขืืื ืืคืืชืื ืืฉืืื AI ืื ืื ืื ื ืืืื, ืฉืคื ืืืื ืคืืชืืช ื AI ืืช ืืืคืฉืจืืช ืืืืืช ืืจืื ืืืชืจ ืคืจืืืืงืืืื.
1 419
ืืืืืืืื ื. AI. ืฉืื ืืืื.
ืืืืืืืื ื ืืคื ืืฉื ืื ืืืืจืื ืืช ืืจืขืืื ืืืื ืืืจื ืืกืื ืืจืืืช ืื ืื ืฉืื ืืืชืืื CSS. ืื ืืชื ืืคืชืื ืืื ืืืืืืืช ื ืชืงืืชื ืื ืืื ืจืื ืื ืืชืืชื ืื. ืืฉืืื ืืืชื ืืชืืื ืืช ืืืืืืืื ื ืืื ืื ื ืกืคืจืืืช ืชืื ืืืช ืฉืืืืืื ืืื ืืืื ืืืฉืชืืฉ ืืืืืืืืื ื ืืื ืืื ืืช ืืืจืื ืืคืื. ืืกืคืจืื ื ืงืจืื tailwind ui ืืืื ืืื ื ืงืจืืช tailwind plus ืืืืืืจืืช ืฉืื ืขืืืจืืช ืืืื ืืืืืืง ืืช ืืขืกืง ืืืืืฉืื ืืคืชื ืืช ืืคืจืืืืืืจืง.
ืืื ืืืืข AI.
ืกืืื ื ืงืืืื ืืืื ืื ืืืฉืืืื ืืื ืืืื ืื ืืช ืืขืืืงืื ืฉื ืืืขืจืืช ืืื ืืืชืื CSS ืื ืืืืขืื ืืืืชืื ืืืืืืืื ื ืื ืืืืขืื ืืืฉ ืืื. ืืฉืงื ืืชื ืืช tailwind ui ืืจืืฉืชื ืฉืขืฉืืชื ืืช ืืงื ืื ืฉื ืืืืื. ืืจืืจ ืื ืื ืืื ืืื ืืื ืื ืืกื ืื ืฉืขืืช ืฉื ืืชืืืช CSS ืื ืชื ืื ืงืืืคืื ื ืืืช ืฉื ืจืื ืืื ืืฉืื ืืื ืคืจืืืงื. ื ืื ืืชื ืืืชืื ืืืช, ื ืื ืืชื ืืืืืจ ืืืงืื ืืืืืืืง ืืงืื ืฉืื, ืืืืชื ืฉืื ื ืืืื ืืฉืื ืืื ืงืื ืงืื ืื ืืฉื ืืช ืืช ืืื ืฉืืืจืื ื ืจืืื. ืืงืืฆืืจ ืืืืชื ืืงืื ืืจืืฆื. ืืื ืืืืข AI ืืืคืกืงืชื ืืืชืื HTML-ืื, CSS-ืื ืืืช ืื ืืงืืืกืื ืฉื ืืืืืืืื ื. ืืชืืืืช ืืคืจืืืงื ืื ื ื ืืชื ื AI ืื ืืขืฆื ืืื ืืืชืื ืืช ื CSS ืืืฉืคืจืืืงื ืืชืืื ืืืืฉืื ืื ื ืืืืจ ืืช ื MCP ืฉื ืคืืืื ืื ืืชื ื AI ืืืืจ ืืฉืจ ืขื ืืืขืฆืืื. ืืขืื ืคืชืืจื. ืืื ื ืื ืืืืื.
ืืื ืขืืื ืืืืจืื ื ืฉืืื ืคืืืจ ืืช ืจืื ืืขืืืืื ื tailwind labs. ืื ื ืืืืืง ืืื ืืช ืืืืืขื ืฉืื ืื ืืื ืืกืคืจืช ืืืื ืขื AI ืืขื ืืฉืื ืืืื ืฉืืื ืืืื ืืืืื ืืชืขืฉืืื:
> I totally see the value in the feature and I would like to find a way to add it.
> But the reality is that 75% of the people on our engineering team lost their jobs here yesterday because of the brutal impact AI has had on our business. And every second I spend trying to do fun free things for the community like this is a second I'm not spending trying to turn the business around and make sure the people who are still here are getting their paychecks every month.
> Traffic to our docs is down about 40% from early 2023 despite Tailwind being more popular than ever. The docs are the only way people find out about our commercial products, and without customers we can't afford to maintain the framework. I really want to figure out a way to offer LLM-optimized docs that don't make that situation even worse (again we literally had to lay off 75% of the team yesterday), but I can't prioritize it right now unfortunately, and I'm nervous to offer them without solving that problem first.
> @PaulRBerg I don't see the AGENTS.md stuff we offer as part of the sponsorship program as anything similar to this at all โ that's just a short markdown file with a bunch of my own personal opinions and what I consider best practices to nudge LLMs into writing their Tailwind stuff in a specific way. It's not the docs at all, and I resent the accusation that I am not disclosing my "true intentions" here or something.
> @mtsears4 Tailwind is growing faster than it ever has and is bigger than it ever has been, and our revenue is down close to 80%. Right now there's just no correlation between making Tailwind easier to use and making development of the framework more sustainable. I need to fix that before making Tailwind easier to use benefits anyone, because if I can't fix that this project is going to become unmaintained abandonware when there is no one left employed to work on it. I appreciate the sentiment and agree in spirit, it's just more complicated than that in reality right now.
ื ืฉืื ืื ืืจืืื ืฉื 40% ืืชื ืืขื ืืืชืจ, ืืจืืื ืฉื 80% ืืจืืื. ืื ืืจืืจ ืื ืืฃ ืืื ืืืจ ืื ืฆืจืื ืืืคืฉ ืืชืืขืื ืฉืืื ืืื ืงืืจืืื ืืงืืืก ืืกืืื. ื AI ืืืจ ืืืืข. ืืืงืืืืช ืฉืืื ืืื ืืืชื ืืคืชืืื ืฉืื ื ืืขืจืืช ืืื ืืขืฆื ืืจืฆื ืืฉืื ืฉืืจืื ืืื ืืื ืืืืจื ืืช ืืขืฉืืื ืฉื ืืื ืืืช ืืืืคืืื ืฉ tailwind ืืืื. ืืื ืฉืื ืืืื ืืชืืขืื ืืืื.
1 419
ืืืค ืคืืืชืื: ืชืื ืืืช ืฉื ืืืจืืืืช
ืฉืืื ืฉืขืืชื ืืชืืื ืืืืืจื ืืกืื ืืช ืชืฉืืืช ืืื ืืื ืื ืื ืื ืืืฉ ืืคืืืชืื ืืื ืืื ืฉืืืื ืืคืชืืจ ืืขืื ืกืคืฆืืคืืช ืืฆืืจื ืืืืืงืช ืืื ื ืืืืจ ืขื str.format. ืืืื ื ืจืื ืืช ืื.
ืืืชืืจ
ื ืืชืื ืคืื ืงืฆืื ืฉืืืฆืจืช ืงืืฆืื ืืืืืื, ืืื ืืงืืืช ืืกืคืจ ืงืืฆืื ืืืฆืืจ ืืชืืืืืช ืืืืฆืจืช ืืช ืืงืืฆืื ืืคื ืืกืืจ:
def create_files(n, prefix):
for i in range(n):
with open(f"{prefix}{i}", "a") as f:
pass
ืขืืฉืื ื ืฉืคืจ ืืช ืืคืื ืงืฆืื ืืื ืืืคืฉืจ ืืื ืฉืงืืจื ืื ืืืขืืืจ ืชืื ืืช ืืืื ืืฉื ืงืืืฅ. ืื ืจืง ืชืืืืืช ืืื ืื ืกืืืืช ืืื ืฉืืงืืฆืื ืืืื ืืืฉื demo1.txt, demo2.txt.
ืคืชืจืื 1 - ืืขืืจืช ืคืื ืงืฆืื
ืืคืืกื ืงืืื ืื ืืฉื ืืฆืขืชื ืืืขืืืจ ืคืื ืงืฆืื ืขืืืจ prefix ืืื ื ืจืื ืื:
def create_files(n, filename_template):
for i in range(n):
filename = filename_template(i)
with open(filename, "a") as f:
pass
create_files(5, lambda i: f"demo{i}.txt")
ืื ืขืืื ืืื ืงืฆืช ืืกืืจืื ืืืืจืื ืืช ืื ืื ืฉืืคืขืื ืืช ืืคืื ืงืฆืื ืืืขืช ืื ืื lambda.
ืคืชืจืื 2 - ืชืื ืืช ืืืืจืืืช
ืคืืืชืื ืืืืืช ืืืจ ืืืื ืืื ืื ืื ืื ืฉื ืคืขื ืื ืืืฉืื ืฉื ืืฉืชื ืื ืืชืื ืืืจืืืช ืืขืืจืช ืคืงืืืช format. ืื ื ืจืื ืื:
def create_files(n, filename_template):
for i in range(n):
filename = filename_template.format(i=i)
with open(filename, "a") as f:
pass
create_files(5, "demo{i}.txt")
ืืจืื ืืืชืจ ืงื ืื ืืื ืฉืืคืขืื ืืช ืืคืื ืงืฆืื ืืื ืืื ืฉืืืชื ืืืชื.
ื .ื. ืืืืืจื ืขื ืืชื ืฉืืคืฉืจ ืืืื ืืืฉืชืืฉ ื t-strings ืืื ืืืชืื ืืช ืืชืื ืืช ืืื ืืืืช ืฉืืืช ืืืชื ืืขืืช. format ืงื ืืืชืจ, ื ืืื ืืืชืจ ืืืฆื ืืื ืืขืืื. ืื ืื ืื ื t-string ืืืืฉ ืฉื ืคืืืชืื 3.14 ืืืฆืข ืืช ืืฉืขืจืื ืืืื ืืฆืืจืช ืืืืจืืืช ืืืืืง ืืื f-string ืืืื ืื ืืื ืขืืื ืืื.1 419
ืืืฉื ืืช, ืกืคืจืืืช, AI
ืกืคืจืืืช ืืืฆืื ืืืช ืืืืื ืจืื ืืงืื ืชืฉืชืืช ืคื ืืื ืืืืื ืืืชืจ ืงืื ื ืงืืืขืื ืืช ืืืืืืืช ืฉื ืืืคืฉืจื. ืื ืืืืื ืฉืื ื ืขื ืืขืืื. ืืื ืืคืฉืจ ืืืคืจ ืืืื ืืื ืืคืขืืื ืืฉ ืงื ืก. ื ืืงื ืกืคืจืืืช ืจืืื ืืฉื
acts-as-taggable-on ืืฉืืื ืืืืืื:
https://github.com/mbleigh/acts-as-taggable-on
ืืกืคืจืื ืืฆืืื ืช ืืคืืคืืืจืืช ืืื ืื ืืืืืช ืื ืื ืื ืืขืืืื ืืืืช ืืืืื ืฉื ืืฉืืืืช ืขื ืืชืืืืื ืฉืืื, ืืืืืจ ืืคืฉืจ ืืืชืื:
@another_user.skill_list.add("clowning")
ืืื ืื ื ืืชืื:
all_users.each do |u|
u.skill_list.add("clowning")
u.save
end
ื ืืฆืข ืืืื ืคืขืืืืช insert ืืื ืื ืจืื ืืขืื ืืืืฆืืขืื.
ืืื ืืืฉืืืช ืกืืื ืื ืืขืงืืืช ืืชื ืืฉืืืืช ืืื ืคืืฆ'ืจืื:
1. ืกืืื ื ืงืืืื ืืืืืื ืืช ืืกืื ืืจื. ืฉืืืืฉ ืืกืคืจืื ืืืจืกื ืืืงืืจืืช ืฉืื ืขืืฉื ืืืื ืฉืื ืืืืคืฉืจ ืืื ืืขืืื ืืืจ.
2. ืกืคืจืื ืืื ืืืื. ืฉืืืืฉ ืืกืคืจืื ืืืจืกื ืืืงืืจืืช ืฉืื ืืืคืฉืจืช ืื ืืืื ืืช ืืฉืืจืืืื ืืชืืืืงื, ืื ืขืื ืื ื ืืฉืืง ืืคื ืืืืืื.
3. ืงืื ืืกืคืจืื ืขืฆืื ืืชืืกืก ืขื ืืืื ืกื ืฉืืจื-ืฉืืจื. ืืจืื ืืืจืื ืืชืื ืืงืื ืื ืจืื ืืืฉืืจื ืื ืื ื ืื ืกื ืืืื ืืก ื batch ืืคืืื ืฉืื ื ืืืืข ืืื ืืืืื ืฉืืื ืื ืืื.
4. ืื ื ืืืื ืืื ืืช ืืืืฉ ืืช ืื ืืื ืื ืื ืื ืฉืืืฉืืจื ืืขืช ืืืืืฉ ืืื ืกื ื batch, ืืื ืืฃ ืืื ืื ืืืืื ืื ืฉืืขืืืื ืืกืคืจืื ืืื ืืชืืงืื ืื ืฉืื ืืืฉืืื ืืขืืื.
ื 2026 ืืฉ ืืืืื ืขืืื ืืื ืืืืืืืืช ืืืืืื ืฉืืืืขืื ืขื ืกืคืจืื ืืืฆืื ืืช ืืืื ืืืืืฉ ืืื ืฉื ืคืชืจืื ืงืื ืจืง ืืฉืืื ืืืชืงืื. ืื ืืงืื ืฆืจืื ืืืคื ืืืืื ืืงืจืื ืืืจืืืื ืืืงืจื ืงืฆื ืฉืื ื ืืคืืื ืื ืืืืืื ืขืืืฃ ืืืคืฉ ืกืคืจืื. ืื ืื ื ืขืืืื ืื ืืืื ืื ืืจืืฉืืช ืืืืฆืจ ืฉืื ืขืืืฃ ืืชืช ื AI ืืื ืืช ืืฉืื ืืืจ ืืืืฉืชืืฉ ื API ืฉื ืกืคืจืื ืงืืืืช ืืชืืจ ืืกืืก. ืืงืกืืืื ืืืืฉื ื ืืื ืืืืืืฃ.1 419
ืื ืื ื ืืคืืื ืื ืืืื ืืช ืืฉืืจื ืืจืืฉืื ื
ืงืืืืช ืงืื ืฉืขืืื, ืืฆืืืช ืืงืืคื ืืืืจืืฅ ืืืชืืจ ืืฉืชืืฉ ืืชื ืื ืืฆืืื ืืืืืช ืืฃ ืืขืื, ืืื ืืฉ ืจืง ืืขืื ืืืช ืืชืืจ ืืคืชื: ืืชื ืื ืืฆืืื ืืืืื ืืคืืื ืฉืืจื ืืืช ืืื ืืขืจืืื.
ืจืืฆืื ืืืืื? ืืกืคืืง ืืืงืฉ ื AI ืฉืืืชืื ืืื ืืขืจืืช Full Stack ืืืื ืืืืืื ืฉืืชื ืื ืืืืจืื. ืืฉืชืขืฉื ืืฉืื ืืกืืื. ืืื ืื ืืืืคืืืืืช ืฉืืืจื ืืื ืืืืจืฆืืืช ืืืขืจืืช ืขืืืืช ืืืจื ื ืืฉืืืช ืืคืชืืื - ืื ืขืืฉืื ืขื ืื? ืื ืฉืืื ืงืื ืื ืื ืื ื ืื ืืืืืื ืืืืื ืืืชื?
ืืืืืื ืคื ืืจืืจื ืืืืฉืืช ืืืืื ืืื ืฉืืืฉ ืืคืฉืจืืืืช:
1. ืืคืฉืจืืช ืจืืฉืื ื - ืื ื ืืื ืืก ืืืขืจืืช ืจืง ืืืจืื ืฉืื ื ืืืื ืืืืื ืืฉืืืืชื ืืืื ืืืชืื ืืื. ืื ืืชื ืืืื ื AI ืืกื ืืื ืืืง ืืืื ืืืืืื ืืื ืฉืืืืืจ ืืืชืจ ืืืื ืืืคืฉืจ ืืฉืืื ืืื ืืื ืื ืืกื ืืช ืืื ืืืื ื. ื ืืงื ืืืืืื ืืช ืจืืืืก ืื ืื ืืฃ ืคืขื ืื ืืชืืชื ืืืื ืืจืืืืก ืืืชื ืืงืืืื ืืขืจืืช ืืืื ืืจืืืืก ืื AI ืืชื ืชืฆืืจืื ืืื ืฉืืืขืืช ืืื ืืคืขื ื ืื ืงืืจื ืฉื. ืืื ืฉืืืขืืช ืืืื ืืชืกืืืื ืื ืืืขืจืืช ืืืืืจื ืขืืืืช. ืื ืชืืื ืืฉืื ื ืฉืื ืื ื ืืืื ืื ืืฉืืื ืืคืชื, ืขื ืื ืื ืื ื ืืืืืืื ืืื ืขืืฉืื?
2. ืืคืฉืจืืช ืฉื ืื - ืื ื ืืื ืืก ืืืขืจืืช ืื ืฉืขืืื, ืืื ืื ืื ืืืืื ืืื ืขื ืงืจืืืช ืงืื. ืื ืื ืขืืื ืื ื ืืจืืฆื ืืื ืฉืืช ืืงืื ืฉื ืกืคืจืืืช ืืกืืก ืืคืจืืืืืืจืงืื ืื ื ืื ืงืืจื ืืืืื ืื ื AI ืืชื ืืื ืขืืื ืืื ืืืืข ืื ืืื ืขืืฉื. ืื ืชืืื ืืขืื ื ืฉืืืจ ืขื ืื ืืช ืืจืืฉ ืืืืฉื.
3. ืืคืฉืจืืช ืฉืืืฉืืช, ืื ืืื ืฉื AI ืืืื ืืืืื ืืคืชืจืื ืืืืืจืืื, ืื ื ืขืืืจ ืขื ืืงืื ืืืืื, ืื ืกื ืืืืื ืื ืฉืื ื ืืฆืืื ืืืชืืฉืื ืื ืืื ืืืืื ืืื ืืฉืื ืืช ืืงืื ืืคืจืืืงื ืืืชืงืื.
ืฉืืืฉืช ืืืคืฉืจืืืืช ืืจืืขืืช.
ืืจืืฉืื ื ืืจืืขื ืื ืืื ืืจืืืฉื ืืื ืืืืื ืืื, ืืฉ ืื ืฉืื ืืืืื, ืืืื ืจืืฆืื ืืืชืงืื ืืืจืืื ืืช ืื ืื ื ืื ืื ืืืื ืืืฉืืืืช ืืื ืืืื. ืืฉื ืืื ืืจืืขื ืื ืืขืืืืช ืฉืขืืฉืื ืืืื ืขืืืืืช ืืืชืืืืช ืจืง ืืขืชืื ืืืชืฉืืื ืขืืืื ืืืื ืืจืืืืช. ืืฉืืืฉืืช ืคืฉืื ืืืงืืช ืืช ืืจืข ืืฉืชื ืืืคืฉืจืืืืช ืืืืจืืช, ืื ืื ื ืื ืืืืืืื ืืื ืืื ืืกืืฃ ืืื ืืกืื ืืขืืืืช.
ืืืจื ืืฆืืช ืืืืืืื ืืื ืืืืื ืืื ืืืคืื ืืื ืืื ืฉืื ืืืื ืืช ืื ืื ืฉื AI ืืืชื. ืื ืื ืขืืจืช ืฉืืจื ืฉืืจื ืืื ื ืจืื ืืืืื ื ืืื ืื ืืชื ืืืืื ืืืืจ ืืช ืขืืื ืืชืืื ืืื ืืืชืจ ืื AI. ืืฉื AI ืืืชื ืืฉืื ืฉืื ื ืจืื ืืืืื ื ืืชื ืืืืข ืฉืืชื ืฆืืืง ืืื ืืื. ืืชื ืืืื ืืืืคื ืืื ืืืื ืืช ืืืฆืขื ืืืืืข ืืื ืืื ืื ื ืืื ื (ืื ืืืชื ื ืืื ื ืืืืื ืืืจ ืื, ืื ื ืืื ื ืื ืกืืืืช ืืืจืืช).
ืืื ืืืช ืืฉืงืขื ืฉืืืจืฉืช ืืื. ืืื ืื ื ืืืืข ืฉืืืื ืฆืจืืืื ืชืฉืืื ืขืืฉืื ืืืงืื ืืืื ืืืืฉืงืืข ืืืื ืืืืืก ืืืื ืืืืืืื ืืืื ืคืชืจืื ืงื. ืืืื ืืืืจ ืฉืืืื ืืื ืืื ืื ืืืข ืขืฅ ืืื ืืคื ื ืขืฉืจืื ืฉื ื. ืขืืฉืื ืื ืจืง ืืืื ืืฉื ื ืืื ืืื.
1 419
ืืฉืชืฃ ืืช ืืคืืกื ืืื ืฉื ืืื ืืืกืื ื 21 ืฉืขืืจืื ืขื ืื ืืกืช ืชืืื ื ืื ืืืื ืืื
https://addyosmani.com/blog/21-lessons/
1 419
ืืืืืจื ืื connect ืืืืืจ 0 ืื ืืืืจื ื ืืืื ืืืื ืืกืคืจ ืืืืืื ืื ืืจื. ืื ื ืืื ืืชืืื ืืช ืฉืืืช ืืืฉืชื ืื ืืื ืื ืชืืื ืืช ืืืืจืืช ืืฉืืื. ืืืฉืืื ืฉืื ืืืชื ืืืฆืข ืืืฃ ืืืืจืฆืืืช ืืื ืงืฉืจ ืืืืืช ืืืืืืจืื ืฉืืืฆืขื ืื ืื ืืืฆืขื. ืื ื ืืืื ืืื ืงืืื ืืืฉื ืฉืืฉืื ืคื ืืืืจ ืืืื ืฉืืื ืืคื ื ืืช ืชืฉืืืช ืืื ืืืืืจืช ืืฉืืืช ืืื ื ืืื ื ืืื ื ืฉืื ืื ืฉืื ืื ื ืฆืจืืืื ืืืืืช ืืืื ืืืืจืื ืืงืจืืืช ืืขืจืืช Code Review ืฉืืืืขืืช ื AI ืื ืืื ืืื ื ืงืฉื ืืชืช ืคืืืืง ืืืขืื.
ืืืืืืกื
ืืืืง ืืฉื ื ืฉื ืืฉืืื ืืืคื ืืช ืืกืืคืืจ ืืืืชืืจ. ืืคืขื ืืืงืื ืืืืืช ืื ืืกืืืืืฆืื ืืืจื ืืืฃ ืืืืจืฆืืืช ืขืืื ื ืืืฆืื ืื ืื ืงืืื ืฉืืืืืืจื ืื ืื ื ืืืืจืื ืืช ืื ืื ืงืืืืช ืืืขืื ืืื ืืืืืจ ืืฉ ืืืืฉืื ืืืืืืช while ืขื ืฉืืื ืืืชืจ ืืขืืืื. ืขืืืจ ืืืืง ืืื ืืืจ ืื ืืคืฉืจ ืืืืืช ืืกืืฃ ืขื ืกืคืืจืช ืืืขืืืื ืืืืืืื ืืืืืช ืืกืืืืื ืืืืืช ืืื ืืขืืืื ืืฉ ืืืื ืงืืืข. ืื ืืงืื ืืจืืื ืฉืืืจื ืื ืขืืืืช ืืืื ื ืฉืขืฉืื ื ืืฆื ืื ืงืฆืจ:
def part2
i = 0
while @circuits.values.uniq.size > 1
next_p, next_q = @distances[i]
connect(next_p, next_q)
i += 1
pp "#{@circuits.values.uniq.size} circuits remaining"
end
next_p[0] * next_q[0]
end
ื ืืกืืื ืฉื ื
ืืืจืืช ืฉืืงืื ืขืืื ืืื ืขืืืื ืืืจืฉ ืืงืืช ืืจืืืืช ืืืืืืจ ืชืืฆืื ืขื ืงืื ืืืืชื, ืืืืื ืืงืืืฆืืช ืฉืืืฆืขืชื ืื ืืกืคืืง ืืขืื, ืืืืืื ืืฉืืงืืืฆืืช ืืืืืืช. ืืืคืืฉ ืืขืืืื ืืืื ืืืงื ืืคืก ืืื ืืื ืฉืืืืชื ืขื ืื ืืืชืจ ืืื ืืืื ืกืช ืคืจืืืื.
ืืชืืื ื ืืืฉืืื ืืื ืืื ืฉืืขืฆื ืื ืื ื ืื ืฆืจืืืื ืืืฉื ืืืืจื ืืื ืืงืืืืจืืื ืืืช ืฉื ืื ืืคืจืืืื ืืืขืื, ืืื ืจืง ืืืขืช ืขืืืจ ืื ื ืงืืื ืืืืื ืืขืื ืืื ืฉืืืืช. ืฉืืืจืช ืืืขืื ืืชืืจ ืงืืืฆื ืืืืฆืืข ืืืืื ืงืืืฆืืช ืขืืื ืืื ืืื. ืื ืื ืื ืืื ืืืชืจ ืืชืืกืก ืขื ืขืฅ:
1. ืื ื ืงืืื ืืืืฆืืช ืขื ืืื ืฆืืืช.
2. ืื ืคืขื ืฉืืืืจืื ืฉืชื ื ืงืืืืช ืื ืื ื ืืืฆืจืื ืฆืืืช ืืืฉ ืฉืืืืจ ืืช ืฉืชืืื. ืืฆืืจื ืืืืช ืืฉื ืจืฆื ืืืืืช ืืืืื "ืืขืื" ืฉืืืืช ื ืงืืื ืืกืืืืช ื ืฆืืจื ืจืง ืืจืืฅ ืืืขืื ืืขืฅ ืขื ืืฉืืจืฉ. ืื ืฉืชื ื ืงืืืืช ืฉืฉืืืืืช ืืืืชื ืืขืื ืื ืืืื ืฉืืืืืช ืืืืชื ืขืฅ.
3. ืืฉืืื ืืืขืช ืื ืืืืจื ื ืืช ืื ืื ืงืืืืช ื ืืื ืืืฉืชืืฉ ืืืื ื: ืื ืคืขื ืฉืื ืื ื ืืืฆืจืื ืืืืืจ ืืืฉ ื ืืกืืฃ 1 ืืืจืืข ืฉื ืืืข ืืืกืคืจ ืื ืงืืืืช ืคืืืช 1 ืื ืืืืจ ืฉืื ืื ืงืืืืช ืืืืืจืืช ืืืช ืืฉื ืื.
ืื ืืงืื ืฉื ืืืืืงื Circuit ืฉืื ืืืช ืืช ืืขืฅ:
class Circuit
attr_accessor :parent, :name
def initialize(name)
self.name = name
self.parent = self
end
def merge(other)
self.parent = self.parent.parent while self.parent.parent != self.parent
other.parent = other.parent.parent while other.parent.parent != other.parent
return 0 if self.parent == other.parent
c = Circuit.new("#{self.name}<->#{other.name}")
self.parent.parent = c
other.parent.parent = c
return 1
end
end
ืืงืื ืืคืชืจืื ืืขืืจืช Circuit ืืื ืขืืฉืื:
def part2
@circuits = @circuits.map {|k, v| [k, Circuit.new(k.to_s)] }.to_h
cables = @circuits.size - 1
while cables > 0
next_p, next_q = @distances.shift
cables -= @circuits[next_p].merge(@circuits[next_q])
pp "connected #{next_p[0]}, #{next_q[0]}. #{cables} cables remaining"
end
next_p[0] * next_q[0]
end
ืืคืขื ืืงืืืื ืืช ืืืชื ืชืฉืืื ื ืืื ื ืืจืื ืืืชืจ ืืืจ.
Endi mavjud! Telegram Tadqiqoti 2025 โ yilning asosiy insaytlari 
