Value object - Cards example

<?php

// c
$pickedCard = new Card(new CardSuit(CardSuit::SPADES), new CardRank(CardRank::ACE));

// d
$aceSpade = new Card(CardSuit::spades(), CardRank::ace());
$twoSpade = new Card(CardSuit::spades(), CardRank::two());
if ($aceSpace->isGreaterThan($twoSpade)) {
    // do something when greater, such as sum the weight to count points
}

3461. Check If Digits Are Equal in String After Operations I

You are given a string s consisting of digits. Perform the following operation repeatedly until the string has exactly two digits: For each pair of consecutive digits in s, starting from the first digit, calculate a new digit as the sum of the two digits modulo 10. Replace s with the sequence of newly calculated digits, maintaining the order in which they are computed. Return true if the final two digits in s are the same; otherwise, return false.
/**
 * @param {string} s
 * @return {boolean}
 */
var hasSameDigits = function(s) {
    // Convert the input string into an array of digits (as numbers)
    let digits = s.split('').map(Number);

    // Repeat the transformation until only two digits remain
    while (digits.length > 2) {
        let nextDigits = [];

        // Loop through each pair of consecutive digits
        for (let i = 0; i < digits.length - 1; i++) {
            // Compute the sum modulo 10
            let sumMod10 = (d

Make dropdown Menu items accessible in YooTheme

<script>
document.addEventListener('DOMContentLoaded', function () {

  // 1) Selecteer alle navigaties waar dropdowns kunnen staan
  const navRoots = document.querySelectorAll('.uk-navbar-nav, .uk-nav');

  // 2) Voeg ARIA aan ouderlinks toe en verberg het icoon voor SR
  navRoots.forEach(nav => {
    nav.querySelectorAll('li.uk-parent > a, li.menu-item-has-children > a').forEach(link => {

      // aria-attributen op de toggle
      link.setAttribute('aria-haspopup', 'true');
      if (!link.h

HTTP Requests Learning

## I am Learning HTTP requests. So I will record my learning journey here. 🚀

// ========================================
// lib/api.ts
// ========================================

// Your best-of-both-worlds Axios instance is ready (JWT + logging + 401 handling).

// Attach token automatically

// Redirect to /login on 401

// Simplified response (response.data)

import axios from 'axios';
import Router from 'next/router';

const api = axios.create({
  baseURL: process.env.NEXT_PUBLIC_API_URL || 'http://localhost:5000',
  headers: { 'Content-Type': 'application/json' },

3347. Maximum Frequency of an Element After Performing Operations II

You are given an integer array nums and two integers k and numOperations. You must perform an operation numOperations times on nums, where in each operation you: Select an index i that was not selected in any previous operations. Add an integer in the range [-k, k] to nums[i]. Return the maximum possible frequency of any element in nums after performing the operations.
/**
 * @param {number[]} nums
 * @param {number} k
 * @param {number} numOperations
 * @return {number}
 */
var maxFrequency = function (nums, k, numOperations) {
    // Sort the array to enable binary search and range grouping
    nums.sort((a, b) => a - b);

    let maxFreq = 0;
    const numCount = new Map(); // Stores frequency of each unique number
    const candidateModes = new Set(); // Stores potential target values to maximize frequency

    // Helper to add a value and its ±k neighbors

Sonar Tips and Tricks

# Sonar Tips and Tricks

### Specify project name

Add to the parent pom in the properties part:

```
  <properties>
    <sonar.projectKey>NAME-IN-SONAR-QUBE</sonar.projectKey>
  </properties>
```

b2b-checkout v5

// /b2b‑checkout.js

import wixUsers from 'wix-users';
import wixLocation from 'wix-location';
import { session } from 'wix-storage-frontend';
import { getMemberCheckoutProfile, createOrderFromProfile } from 'backend/b2bCheckout.jsw';

const COUNTRY_NAMES = {
  AT: 'Österreich',
  DE: 'Deutschland',
  CH: 'Schweiz',
  IT: 'Italien'
  // weitere Ländercodes ergänzen …
};

$w.onReady(function () {
  const logs = [];
  resetFields();
  if ($w('#paymentMethodRadio'))        $w('#pa

b2bCheckout.jsw v5

// backend/b2bCheckout.jsw

import { currentMember } from 'wix-members-backend';
import { contacts } from 'wix-crm-backend';
import wixData from 'wix-data';
import wixStores from 'wix-stores-backend';

/* --------------------------- Helper: UUID + Country --------------------------- */
function pseudoUuid() {
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
    const r = (Math.random() * 16) | 0;
    const v = c === 'x' ? r : (r & 0x3) | 0x8;
    return v.toStr

CSSとSVGのstrokeの太さの違い

<p class="text">CSSの場合</p>
<svg class="svg1" viewBox="0 0 300 200">
  <rect fill="red" stroke="black" stroke-width="10" x="0" y="0" width="300" height="200"></rect>
</svg>
<svg class="svg2" viewBox="0 0 300 200">
  <rect fill="red" stroke="black" stroke-width="10" x="0" y="0" width="300" height="200"></rect>
</svg>
<!-- vector-effect="non-scaling-stroke" でも解決可能 -->
<svg class="svg2" viewBox="0 0 300 200">
  <rect fill="red" vector-effect="non-scaling-stroke" stroke="black" stroke-width="10" x="0

Allow AI Bots (robots.txt)

Add in robots.txt to allow major AI bots
User-agent: *
Disallow: /dev/wp-admin/
Allow: /dev/wp-admin/admin-ajax.php
 
Sitemap: https://fiva.gr/sitemap_index.xml

# OpenAI's GPTBot
User-agent: GPTBot
Allow: /

# Anthropic's ClaudeBot
User-agent: ClaudeBot
Allow: /

# Google AI crawler (Google-Extended)
User-agent: Google-Extended
Allow: /

# Perplexity AI crawler
User-agent: PerplexityBot
Allow: /

# Generic allow for everything else
User-agent: *
Disallow:

Spring Boot API security using JWT

<dependencies>
    <!-- Spring Boot Web + Security -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <!-- JWT -->
    <dependency>
        <groupId>io.jsonwebtoken</groupId>
        <artifactId>jjwt-api</artifactId>
        <version>

3346. Maximum Frequency of an Element After Performing Operations I

You are given an integer array nums and two integers k and numOperations. You must perform an operation numOperations times on nums, where in each operation you: Select an index i that was not selected in any previous operations. Add an integer in the range [-k, k] to nums[i]. Return the maximum possible frequency of any element in nums after performing the operations.
/**
 * @param {number[]} nums - The input array of integers
 * @param {number} k - The maximum value that can be added/subtracted in one operation
 * @param {number} numOperations - The total number of operations allowed
 * @return {number} - The maximum frequency of any element after operations
 */
var maxFrequency = function(nums, k, numOperations) {
    const n = nums.length;

    // Sort the array to enable binary search and range grouping
    nums.sort((a, b) => a - b);

    // Precompute f

Sandbox: bash(72986) deny(1) file-write-data /Users/XXX/ios/Pods/resources-to-copy-XXXShareExtension.txt

## 描述:
报错:
> Sandbox: bash(27727) deny(1) file-write-create /Users/reedwen/Documents/demo/RxDemo/Pods/resources-to-copy-RxDemo.txt
## 解决:
update your Xcode project build option 'ENABLE_USER_SCRIPT_SANDBOXING' to 'No'.

# 参考
- [Sandbox: bash(72986) deny(1) file-write-data /Users/XXX/ios/Pods/resources-to-copy-XXXShareExtension.txt](https://stackoverflow.com/a/76792332)

Helps

# resolve to absolute path
abs_path = Path("./google_maps_urls/property_management_q/Arizona/pm_results/results.json").resolve()
print("Absolute path is:", abs_path)

Pod Install - ArgumentError - invalid byte sequence in UTF-8


# Pod Install - ArgumentError - invalid byte sequence in UTF-8

## 描述:
> `ArgumentError - invalid byte sequence in UTF-8`, 反复检查Podfile发现没有问题
## 分析:
> 分析原因:可能指定了多个源冲突了?

## 解决:显示指定源
添加`source 'https://github.com/CocoaPods/Specs.git'`
```rb
source 'https://github.com/CocoaPods/Specs.git'

target 'RxDemo' do
  pod 'RxSwift', '6.9.0'
  pod 'RxCocoa', '6.9.0'
end
```

## 参考
- [Pod Install - ArgumentError - invalid byte sequence in UTF-8](https://github.com/CocoaPods/CocoaPods/issues/9853)

GET - All Line Items and Store it from a Deal - HubSpot

This snippet is used to retrieve all line items from a Job and store them from a HubSpot Deal.
const data = $.getNodeData('GET Line Items from HubSpot Deal')[0].data;

const lineItems = data.associations?.["line items"]?.results || [];
const lineItemIds = lineItems.map(item => item.id);

return lineItemIds.map(id => ({ id }));