3637. Trionic Array I

You are given an integer array nums of length n. An array is trionic if there exist indices 0 < p < q < n − 1 such that: nums[0...p] is strictly increasing, nums[p...q] is strictly decreasing, nums[q...n − 1] is strictly increasing. Return true if nums is trionic, otherwise return false.
/**
 * @param {number[]} nums
 * @return {boolean}
 */
var isTrionic = function(nums) {
    const n = nums.length;

    // Need at least 4 elements to form inc → dec → inc
    if (n < 4) return false;

    let i = 0;

    // -------------------------------
    // Phase 1: strictly increasing
    // -------------------------------
    while (i + 1 < n && nums[i] < nums[i + 1]) {
        i++;
    }

    // If we never increased or we stopped at the last element,
    // we cannot form the required 

Commands

.claude
  commands
    code.review.md

"Perform an in-depth code review of our codebase - focus on security an logical bugs."

Skills

add skills to
.claude
  skills
    subfolder (open naming)
      SKILL.md (must be named like this)
      
Content:
---
name: name of the subfolder (must be the same)
description: ...
---

https://skills.sh/

Subagents

add subagents to
.claude
  agents
    agentName
    
Add specific information about what and when to use wenn executing promts in CLAUDE.md file.

MCP

Use web search or context7 mcp to find relevant documentation for... > promt to read some specific documentation

CLAUDE.MD

on top of the document add pointer to @SPECS.MD file. Also add some short description for the basic information about the app.

add note to "Keep your replies extremly concise and focus on conveying the key information. No unnecessary fluff, no long code snippets."

file pointing

We are bulding an app described in @SPEC.MD > this we point to a file in a promt

<better-auth-database-docs>
Use XML tags to wrap a certain pard of text in documentation
</better-auth-database-docs>

commands

claude init > initialise the project
claude -p "expalin this project" > hides the process and shows only result
/resume > shows previous sessions
claude -c > opens last session
claude --dangerously-skip-permissions > all permissions are granted, confirmation will not be assked again
/sandbox or docker sandbox run claude > will create a sandbox and limit claude access to computer outside of sandbox, important if using --dangeroulsy... settings
2x ESC btn clicks or /rewind rewinds the last changes

How to optimize png images using the terminal?

# using pngquant package
https://github.com/kornelski/pngquant

How to revert changes made in a commit from a branch ?

# git revert creates a new commit that undoes the changes from a specific commit. It doesn't remove commits from history or revert "until" a point.

# How git revert works:
#  Creates a new commit that reverses the changes
#  Doesn't delete or remove commits from history
#  Works on specific commits, not ranges

# Important: Order matters
# Revert in reverse chronological order (newest first) to avoid conflicts:

git revert [commit hash]

背景色付きテキスト 改行対応

.hoge {
	display: inline;
	line-height: 2.5;
	background-color: rgba($color: #fff, $alpha: 0.8);
	box-decoration-break: clone;
	-webkit-box-decoration-break: clone;
	padding: 6px 10px;
}

3013. Divide an Array Into Subarrays With Minimum Cost II

You are given a 0-indexed array of integers nums of length n, and two positive integers k and dist. The cost of an array is the value of its first element. For example, the cost of [1,2,3] is 1 while the cost of [3,4,1] is 3. You need to divide nums into k disjoint contiguous subarrays, such that the difference between the starting index of the second subarray and the starting index of the kth subarray should be less than or equal to dist. In other words, if you divide nums into the subarrays nums[0..(i1 - 1)], nums[i1..(i2 - 1)], ..., nums[ik-1..(n - 1)], then ik-1 - i1 <= dist. Return the minimum possible sum of the cost of these subarrays.
/**
 * @param {number[]} nums
 * @param {number} k
 * @param {number} dist
 * @return {number}
 */
var minimumCost = function(nums, k, dist) {
    const n = nums.length;
    const INF = Number.MAX_SAFE_INTEGER;

    // If we only need 1 subarray, it's just the whole array starting at 0.
    if (k === 1) return nums[0];

    let sum = 0;          // sum of values currently chosen (size = used.size, up to k-1)
    let ans = INF;
    const used = new Set(); // indices currently chosen as starts (k-

SVG Optimizer

https://svgomg.net/

GA4 - menu - Bioderma

<script>
  window.dataLayer = window.dataLayer || [];
  window.dataLayer.push({
        event: 'navigation', // Name of the event
    // Common event parameters
    parameters: {
      parameter1: 'todos los productos', // categoría padre
      parameter2: 'corporal', // subcateogría
      parameter3: 'higiene corporal' // sección
  });
</script>

内部処理用のid(index)と外部公開用のUUIDを両方保持するテーブル設計

```sql
CREATE TABLE users (
    id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,  -- 内部用(高速)
    uuid BINARY(16) NOT NULL UNIQUE,                 -- 外部公開用
    name VARCHAR(255),
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    
    INDEX idx_uuid (uuid)
);

-- 挿入
INSERT INTO users (uuid, name) 
VALUES (UUID_TO_BIN(UUID(), 1), 'Taro');
```

### 使い分け
内部JOIN・FK: id (BIGINT)
APIレスポンス: uuid
URL: /users/{uuid}
ログ・デバッグ: id でも uuid でもどちらでも可

プリフライトリクエストについて

### ブラウザが自動で実施するケース
- GET、POST、HEAD 以外のメソッド(PUT、DELETE など)
- カスタムヘッダーを含む(Authorization、X-Custom-Header など)
- Content-Type が application/json など

### 実行順序

1. ブラウザがOPTIONSメソッドでプリフライトリクエストを送る
2. サーバーが許可情報(許可するオリジン・メソッド・ヘッダー)を返す
3. ブラウザが許可情報を検証し、本番リクエストが許可されているか判断する
4. 許可されていれば、ブラウザが本番リクエストを送る
5. サーバーがリクエストを処理する
6. サーバーがレスポンスを返す
7. ブラウザがレスポンスを受け取り、JavaScriptに結果が返る

### 送信側の構成要素
```javascript
const response = await fetch('http://localhost:8080/api/users', {
  method: 'OPTIONS',  // プリフライトは必ずOPTIONSメ