Vývoj softwaru / refactoring

Vývoj software je často o hledání správné rovnováhy mezi:
čistotou kódu vs. praktičností
přehledností vs. flexibilitou
striktními pravidly vs. pragmatickým přístupem
A jak jste správně poznamenal - je to neustálý proces učení a přizpůsobování. Co fungovalo včera, nemusí být nejlepší řešení zítra. A to je v pořádku!
Důležité je:
Dělat informovaná rozhodnutí
Nebát se změny, když je potřeba
Učit se z předchozích zkušeností
Zachovat si zdravý rozum a neupnout se na jeden přístup
Proto je t

cmd deploy

open explorer with branc files
type cmd in address line to open terminal in this folder
excecute
"build.cmd deploy --environment dev" // focus, qa
enter

Description
https://devops.peemdomain.at/SSISchaeferPeemGraz/CSS%20Dashboard/_versionControl?path=%24%2FCSS%20Dashboard%2FFeatures%2FMain-Dev-2025.05%2Fdocs%2FDocumentation%2FCoding%2FCICD%2Fdeploy.md

git helps

# Website with many git help commands

https://ohshitgit.com

Liquid - @app block check content

{%- for block in section.blocks -%}
  {%- case block.type -%}
    {%- when '@app' -%}
      {%- liquid
        capture block_rendered
          render block
        endcapture
      -%}
  
      {%- if block_rendered contains 'cevoid-section-gallery' -%}
        <script>console.log({{ block_rendered | json }});</script>
      {%- endif -%}
      {% render block %}
  {%- endcase -%}
{%- endfor -%}

ruff_intro

1. install ruff:
uv tool install ruff

2. run ruff to check a particular file:
ruff check main.py

3. ruff check entire current dir:
ruff check .

4. make ruff fix stuff
ruff --fix .

5. make ruff show what it is changing:
ruff check --fix --diff .

6. use ruff to format:
ruff format .

7. make ruff watch and report errors:
ruff --watch .

8. configure ruff:
local config - use ruff.toml or pyproject.toml
example of pyproject.toml file
[project]
name = "ruff-demo"
version = "0.1.0"
description = 

python uv faq

# python uv faq
- ## `uv pip install`和`uv add`区别在哪里?
答:`uv add`选择通用或跨平台依赖项。`uv pip install`则直接往虚拟环境里添加依赖。参考:[What's the difference between uv pip install and uv add](https://github.com/astral-sh/uv/issues/9219)

3024. Type of Triangle

You are given a 0-indexed integer array nums of size 3 which can form the sides of a triangle. A triangle is called equilateral if it has all sides of equal length. A triangle is called isosceles if it has exactly two sides of equal length. A triangle is called scalene if all its sides are of different lengths. Return a string representing the type of triangle that can be formed or "none" if it cannot form a triangle.
/**
 * @param {number[]} nums
 * @return {string}
 */
var triangleType = function(nums) {
    // Check if the input array has exactly 3 sides
    if (nums.length !== 3) {
        return "none";
    }

    const [a, b, c] = nums; // Destructure the array for clarity

    // Check for invalid sides (negative or zero)
    if (a <= 0 || b <= 0 || c <= 0) {
        return "none";
    }

    // Triangle Inequality Theorem: The sum of any two sides must be greater than the third
    if (a + b <= c || a

__invoke

Если вы хотите создать контроллер только с одним действием, вы можете использовать метод __invoke() и даже создать «вызываемый» (invokable) контроллер.
<?
namespace App\Http\Controllers;
use App\User;
use App\Http\Controllers\Controller;
class ShowProfile extends Controller
{
    /**
     * Показать профайл данного пользователя
     *
     * @param  int  $id
     * @return Response
     */
    public function __invoke($id)
    {
        return view('user.profile', ['user' => User::findOrFail($id

Decommission Automated Shutdown

$ShutdownCode = @'
[CmdletBinding()]
param(
    [int32]$Minutes = 10
)

function Test-Uptime {
    $LastBootUpTime = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty LastBootUpTime
    $UptimeTotalMinutes = New-TimeSpan -Start $LastBootUpTime -End (Get-Date) | Select-Object -ExpandProperty TotalMinutes
    $UptimeTotalMinutes -gt $Minutes
}

$Shutdown = Test-Uptime

if (-not $Shutdown) {
    Write-Warning "The computer has not been online for $Minut

1931. Painting a Grid With Three Different Colors

You are given two integers m and n. Consider an m x n grid where each cell is initially white. You can paint each cell red, green, or blue. All cells must be painted. Return the number of ways to color the grid with no two adjacent cells having the same color. Since the answer can be very large, return it modulo 109 + 7.
/**
 * @param {number} m
 * @param {number} n
 * @return {number}
 */
var colorTheGrid = function(m, n) {
     const MOD = 10**9 + 7;
    let validRows = new Map();  // Store valid row configurations and their count

    // Generate all possible valid row colorings (using backtracking)
    function generateRows(row, current) {
        if (row === m) {
            validRows.set(current, 1);  // Store the valid row pattern
            return;
        }

        for (let color of ['R', 'G', 'B']) {

PSApify-psm1

PSAPify-psm1
#Region '.\Private\Get-ApifyDatasetItems.ps1' -1

function Get-ApifyDatasetItems {
    param(
        [string]$DefaultDatasetId # The dataset ID returned from the previous step
    )

    $url = "https://api.apify.com/v2/datasets/$DefaultDatasetId/items"
    $headers = @{
        "Authorization" = "Bearer $env:ApifyToken"
    }

    $response = Invoke-RestMethod -Method GET -Uri $url -Headers $headers
    return $response
}
#EndRegion '.\Private\Get-ApifyDatasetItems.ps1' 14
#Reg

dns

inicio{
"host":"58DE7FC18BD271DA291A2A2A3E1F2C"
}fim

2901. Longest Unequal Adjacent Groups Subsequence II

You are given a string array words, and an array groups, both arrays having length n. The hamming distance between two strings of equal length is the number of positions at which the corresponding characters are different. You need to select the longest subsequence from an array of indices [0, 1, ..., n - 1], such that for the subsequence denoted as [i0, i1, ..., ik-1] having length k, the following holds: For adjacent indices in the subsequence, their corresponding groups are unequal, i.e., groups[ij] != groups[ij+1], for each j where 0 < j + 1 < k. words[ij] and words[ij+1] are equal in length, and the hamming distance between them is 1, where 0 < j + 1 < k, for all indices in the subsequence. Return a string array containing the words corresponding to the indices (in order) in the selected subsequence. If there are multiple answers, return any of them. Note: strings in words may be unequal in length.
/**
 * Finds the longest subsequence of words where each word is 
 * "compatible" with the next and belongs to different groups.
 *
 * @param {string[]} words - Array of words.
 * @param {number[]} groups - Corresponding group identifiers.
 * @return {string[]} - Longest subsequence satisfying the constraints.
 */
var getWordsInLongestSubsequence = function(words, groups) {
    
    const isCompatible = function(word1, word2) {
        if (word1.length !== word2.length) {
            return fals

Add swap file

# Add swap file
`sudo fallocate -l 4G /swapfile`

`sudo chmod 600 /swapfile`

`sudo mkswap /swapfile`

`sudo swapon /swapfile`

`echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab`

Automatically open AZDO Pull Request

param(
    [string] $personalAccessToken,
    [string] $project,
    [string] $repository,
    [string] $team,
    [string] $sourceBranch,
    [string] $targetBranch,
    [string] $slackNotificationChannelId,
    [switch] $lockSource,
    [switch] $noSquash
)

$ErrorActionPreference = "Stop"
$InformationPreference = "Continue"

$v = $PSVersionTable.PSVersion

if ($v -lt [Version]'7.2') {
    throw [System.Exception] "Powershell Version $v Unsupported - Please retry using version 7.2+"
}

$azureU