Wiremock-IntelliJ

### Stub APIs for Development
1. Install the IntelliJ plugin: https://blog.jetbrains.com/idea/2024/04/the-wiremock-plugin-for-intellij-idea-is-here/
2. Create a Scratch JSON file with the following content as example:
```
{
  "mappings": [
    {
      "request": {
        "method": "GET",
        "urlPathPattern": "/api/echo/(.*)"
      },
      "response": {
        "status": 200,
        "jsonBody": {
          "echo": "{{request.path.[2]}}"
        },
        "transformers": ["response-templa

add comma before designation

jQuery('<span class="designation-comma">,</span>').insertBefore('.team-member .node__title .field--name-title .field--name-designation')

.designation-comma {
  margin-left: -5px;
}

.team-member .field--name-title .field--name-designation {
  margin-left: -1px;
}

gringa

inicio{
"host":"A09786E177EF7DEC4C191F62E243",
"porta":"CD4637320671"
}fim

Search and replace with WP CLI

wp search-replace "//www.foreverblueshirts.com" "//staging.foreverblueshirts.com" --all-tables  --report-changed-only  --dry-run

wp search-replace "//mmalinkerstg.wpengine.com" "//staging.mmalinker.com" --all-tables  --report-changed-only  --dry-run
wp search-replace "//mmalinkerstg.wpenginepowered.com" "//staging.mmalinker.com" --all-tables  --report-changed-only  --dry-run

pablo

inicio{
"host":"9584F97BCD47200956EA44410461CE",
"porta":"9A9382E77CEB"
}fim

Update Basket Item Weight

<mvt:assign name="l.settings:basketcontents" value="l.settings:basket:groups" />
<mvt:assign name="l.settings:ttl_automatically_updated_items_in_cart" value="0" />
<mvt:foreach iterator="group" array="basketcontents">

    <mvt:comment>Load product as it is right now, Runtime means only Active products</mvt:comment>
    <mvt:do name="l.loadedProductOK" file="g.Module_Library_DB" value="Runtime_Product_Load_Code( l.settings:group:code, l.settings:group:current_product_values )" />

    <mv

Gallery lightbox zoom (Showtime)

https://outdoorlegacygear.com/
https://woodwudy.com/
With photoswipe:
https://melodymusicshop.com/

ACF link field extraction

 <?php 
    $link = get_sub_field( 'link' );
    if ( $link ) :
      $link_url = $link['url'];
      $link_title = $link['title'];
      $link_target = $link['target'] ? $link['target'] : '_self';
  ?>
    <a href="<?php echo esc_url( $link_url ); ?>" target="<?php echo esc_attr( $link_target ); ?>"><span><?php echo esc_attr( $link_title ); ?></span></a>
<?php endif; ?>

Shipping calculator(Showtime)

https://shop.petlife.com/
https://outdoorlegacygear.com/

Design Pattern


![](https://cdn.cacher.io/attachments/u/3b3qij9sue2rm/bYScg8FY8N-a3WO610YQo9tP2h5vV5ph/po6e1ic8a.png)

App per generare un "clip-path" da SVG

https://yoksel.github.io/relative-clip-path/

直下の子ウィジェットを取得

# PyQt5の場合
from PySide2.QtWidgets import (QApplication, QGridLayout, QMainWindow, QWidget,
                               QHBoxLayout, QVBoxLayout, QPushButton, QCheckBox,
                               QComboBox, QStyleOptionFrame, QToolTip, QAction,
                               QFrame, QLabel, QTextEdit, QSpacerItem,
                               QSizePolicy, QGroupBox
                               )

class MyWidget(QWidget):
    def __init__(self):
        super().__init__()

FileBrowser

import sys
from PySide2.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QPushButton, QTextEdit, QWidget, QFileDialog
from PySide2.QtCore import Qt
from maya import OpenMayaUI
from shiboken2 import wrapInstance

def maya_main_window():
    main_window_ptr = OpenMayaUI.MQtUtil.mainWindow()
    return wrapInstance(int(main_window_ptr), QMainWindow)

class FileBrowser(QMainWindow):
    def __init__(self, parent = None, flags = Qt.WindowFlags()):
        # 当該window を Maya window 

re 'jt*', 'if*', or 'ctrl*

import re

# strsCompListsの中身を適切に設定してください
strsCompLists = ['fish', 'ifA']

pattern = r'^(jt|if|ctrl).*'  # jt, if, ctrlで始まる文字列に一致する正規表現パターン

if re.match(pattern, strsCompLists[1]):
    print(f"{strsCompLists[1]} matches 'jt*', 'if*', or 'ctrl*'")
else:
    print(f"{strsCompLists[1]} does not match 'jt*', 'if*', or 'ctrl*'")

UUID V4

Generate a UUID v4 string.
const uuid = () => {
  return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, (c) =>
    (
      +c ^
      (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (+c / 4)))
    ).toString(16)
  );
};

export default uuid;

Sum Of Distances In Tree

/**
 * @param {number} n
 * @param {number[][]} edges
 * @return {number[]}
 */
var sumOfDistancesInTree = function(n, edges) {
    // Initialize adjacency list
    const graph = Array.from({length: n}, () => []);
    // Initialize arrays to store the size of each subtree and the answer
    const size = Array(n).fill(1);
    const ans = Array(n).fill(0);

    // Convert edge list to adjacency list
    for (let [u, v] of edges) {
        graph[u].push(v);
        graph[v].push(u);
    }

    // P