cats slugs

SELECT
--     pst.name AS segment_type,
    MAX(CASE WHEN psi.lang_id = 1 THEN psi.name END) AS name_lang_1,
    MAX(CASE WHEN psi.lang_id = 2 THEN psi.name END) AS name_lang_2,
    MAX(CASE WHEN psi.lang_id = 1 THEN psi.slug END) AS slug_lang_1,
    MAX(CASE WHEN psi.lang_id = 2 THEN psi.slug END) AS slug_lang_2
FROM products_segments ps
JOIN products_segments_type pst ON pst.id = ps.type
JOIN products_segments_i18n psi ON psi.product_category_id = ps.id
WHERE pst.name IN ('category', 'subcateg

list new cats and subcats

SELECT psi.name, ps.cat_id, ps.parent_category_id, pst.name, ps.is_active
FROM products_segments ps
JOIN products_segments_type pst ON pst.id = ps.type
JOIN products_segments_i18n psi ON psi.product_category_id = ps.id
WHERE pst.name IN ('category', 'subcategory')
AND psi.lang_id = 1
ORDER BY ps.cat_id

cats slugs

SELECT
--     pst.name AS segment_type,
    MAX(CASE WHEN psi.lang_id = 1 THEN psi.name END) AS name_lang_1,
    MAX(CASE WHEN psi.lang_id = 2 THEN psi.name END) AS name_lang_2,
    MAX(CASE WHEN psi.lang_id = 1 THEN psi.slug END) AS slug_lang_1,
    MAX(CASE WHEN psi.lang_id = 2 THEN psi.slug END) AS slug_lang_2
FROM products_segments ps
JOIN products_segments_type pst ON pst.id = ps.type
JOIN products_segments_i18n psi ON psi.product_category_id = ps.id
WHERE pst.name IN ('category', 'subcateg

list new cats and subcats

SELECT psi.name, ps.cat_id, ps.parent_category_id, pst.name, ps.is_active
FROM products_segments ps
JOIN products_segments_type pst ON pst.id = ps.type
JOIN products_segments_i18n psi ON psi.product_category_id = ps.id
WHERE pst.name IN ('category', 'subcategory')
AND psi.lang_id = 1
ORDER BY ps.cat_id

762. Prime Number of Set Bits in Binary Representation

Given two integers left and right, return the count of numbers in the inclusive range [left, right] having a prime number of set bits in their binary representation. Recall that the number of set bits an integer has is the number of 1's present when written in binary. For example, 21 written in binary is 10101, which has 3 set bits.
/**
 * @param {number} left
 * @param {number} right
 * @return {number}
 */
var countPrimeSetBits = function(left, right) {
    // Precompute the only primes we care about.
    // No integer in this range will have more than ~20 set bits.
    const primes = new Set([2, 3, 5, 7, 11, 13, 17, 19]);

    let count = 0;

    // Iterate through every number in the inclusive range
    for (let n = left; n <= right; n++) {
        // Convert to binary and count the number of '1' bits
        // Example

761. Special Binary String

Special binary strings are binary strings with the following two properties: The number of 0's is equal to the number of 1's. Every prefix of the binary string has at least as many 1's as 0's. You are given a special binary string s. A move consists of choosing two consecutive, non-empty, special substrings of s, and swapping them. Two strings are consecutive if the last character of the first string is exactly one index before the first character of the second string. Return the lexicographically largest resulting string possible after applying the mentioned operations on the string.
/**
 * @param {string} s
 * @return {string}
 */
var makeLargestSpecial = function(s) {
    // This array will hold all top-level special substrings
    let subs = [];

    // We'll scan the string and find balanced segments
    let count = 0;
    let start = 0;

    for (let i = 0; i < s.length; i++) {
        // '1' increases balance, '0' decreases it
        if (s[i] === '1') count++;
        else count--;

        // When count returns to 0, we found a complete special substring
        if (

Fetch userlist with handling via AbortController

import { useEffect, useState } from "react"
import { User } from "./User"

export default function App() {
  const [users, setUsers] = useState([])
  const [error, setError] = useState(null)
  const [status, setStatus] = useState("idle")

  useEffect(() => {
    setStatus("loading")
    setUsers([])
    setError(null)

    const controller = new AbortController()
    fetch("https://jsonplaceholder.typicode.com/users", {
      signal: controller.signal,
    })
      .then(res => 

hribi.net gallery arrow keys navigation Violentmonkey Script

hribi.net gallery arrow keys navigation Violentmonkey Script
// ==UserScript==
// @name        hribi.net gallery arrow keys
// @namespace   Violentmonkey Scripts
// @match       https://www.hribi.net/*
// @grant       none
// @version     1.0
// @author      -
// @description 5/3/2025, 7:04:37 PM
// ==/UserScript==
const backButton = document.querySelector('.slikanazaj > a');
const forwardButton = document.querySelector('.slikanaprej > div:not(.slikanazaj2) > a');

document.addEventListener('keydown', function(event) {
  if (event.key === 'ArrowLeft' && b

tools

Saved from https://github.com/wincent/wincent
./install dotfiles nvim     # Just install "dotfiles" and "nvim" stuff.
./install dotfiles          # Just install "dotfiles".
./install dotfiles --step   # Prompt for confirmation at each step.
./install dotfiles --check  # Do a dry-run, showing what would be changed.
./install                   # Install everything.
./install ^homebrew         # Install everything except for the "homebrew" aspect.
./install --help            # Lists all aspects, descriptions, options.

Add-CMSoftwareUpdateFilePath

Adds a FilePath property to an object passed from Get-CMSoftwareUpdate showing the location of the physical files being delivered to deployment points and client systems.
function Add-CMSoftwareUpdateFilePath {
    # Pipe Get-CMSoftwareUpdate to this function
    $CMSoftwareUpdate = @($input)

    $sitecode = (Get-CimInstance -ClassName SMS_Authority -Namespace root\ccm).Name.Split(':')[1]
    $NameSpace = "root\SMS\site_$sitecode"

    $UpdateCIIDs = $CMSoftwareUpdate.CI_ID
    if ($UpdateCIIDs.Count -eq 0 ) { Write-Warning "No updates returned."; return }

    foreach ($UpdateCIID In $UpdateCIIDs) {
        $UpdateContent = Get-CimInstance -Namespace

Set CMTrace as Default for Log Files

$cmtrace = "C:\Windows\CCM\CMTrace.exe"
cmd /c assoc .log=CMTrace.LogFile
cmd /c assoc .lo_=CMTrace.LogFile
cmd /c ftype CMTrace.LogFile="$cmtrace" "%1"

Github README Template

# Introduction
- Add your project logo.
- Write a short introduction to the project.
- If you are using badges, add them here.

## :ledger: Index

- [About](#beginner-about)
- [Usage](#zap-usage)
  - [Installation](#electric_plug-installation)
  - [Commands](#package-commands)
- [Development](#wrench-development)
  - [Pre-Requisites](#notebook-pre-requisites)
  - [Developmen Environment](#nut_and_bolt-development-environment)
  - [File Structure](#file_folder-file-structure)
  - [Build](#hammer-

696. Count Binary Substrings

Given a binary string s, return the number of non-empty substrings that have the same number of 0's and 1's, and all the 0's and all the 1's in these substrings are grouped consecutively. Substrings that occur multiple times are counted the number of times they occur.
/**
 * @param {string} s
 * @return {number}
 */
var countBinarySubstrings = function(s) {
    // Step 1: We'll store the lengths of consecutive groups.
    // Example: "0011100" -> [2, 3, 2]
    let groups = [];
    let count = 1; // count the current run length

    // Step 2: Build the groups array
    for (let i = 1; i < s.length; i++) {
        if (s[i] === s[i - 1]) {
            // same character → extend current group
            count++;
        } else {
            // character changed

Previous sibling selector CSS

.section__header {
  margin-bottom: 32px;
}

.section__header:has(+ .section__subheader) {
  margin-bottom: 12px;
}

useFetch (custom hook)

import { useState, useEffect } from 'react';

const useFetch = (url) => {
  const [data, setData] = useState(null);
  const [isPending, setIsPending] = useState(true);
  const [error, setError] = useState(null);

  useEffect(() => {
    setTimeout(() => {
      fetch(url)
      .then(res => {
        if (!res.ok) { // error coming back from server
          throw Error('could not fetch the data for that resource');
        } 
        return res.json();
      })
      .then(data =