Access the protected method

// How to access the protected method from outside the class.
$result = (fn() => $this->getMigrationIds())->call(\Drupal::service('weller_xml_importer.migrator'));
dump($result);

switch case if is_page, change ID

<?php

                global $post;
                // get all terms in the taxonomy
                $terms = get_terms( 'works_category' );
                // convert array of term objects to array of term IDs
                $term_ids = wp_list_pluck( $terms, 'term_id' );
                $id;


                switch ( $post->post_name ) {
                    case "electricity":
                        $id = 2;
                        break;
                    case "melting":
               

On grid layout, apply bottom margin to everything but the items on the last row

/* Our Services */
@media screen and (min-width: 40em) {
    .grid-container.our-services > .grid-x > .cell:not(:nth-last-child(-n+3)) {
        margin-bottom: 3rem;
    }
}
@media screen and (min-width: 64em) {
    .grid-container.our-services > .grid-x > .cell:not(:nth-last-child(-n+2)) {
        margin-bottom: 3rem;
    }
}
@media screen and (max-width: 39.9375em) {
    .grid-container.our-services > .grid-x > .cell:not(:last-child) {
        margin-bottom: 3rem;
    }
}

Custom styles for WordPress Editor (wysiwyg)

https://www.hostpapa.com/knowledgebase/how-to-add-custom-styles-to-wordpress-visual-editor/
/**
 * 
 */
function wpb_mce_buttons_2($buttons) {
	array_unshift($buttons, 'styleselect');
	return $buttons;
}
add_filter('mce_buttons_2', 'wpb_mce_buttons_2');

/*
* Callback function to filter the MCE settings
*/
function my_mce_before_init_insert_formats( $init_array ) {  
	$style_formats = array(  
		array(  
			'title' => 'Texto maiúsculo',  
			'block' => 'span',  
			'classes' => 'uppercase',
			'wrapper' => true,			
		),  
		/* array(  
			'title' => 'Blue Button', 

How to create a custom images?

create a file and name it Dockerfile

Add Gutenberg block styles to editor

1. Update config.json to include a new gutenberg.scss file. 2. Update setup.php to enqueue the new file. 3. Edit guternberg.scss, copy in any essential styles from main.scss. 4. Build the project again.
"gutenberg": [
  "./styles/gutenberg.scss"
],

test2 fsds

test2 fsds
import re

print("sdfsdf")

background-imageを画面解像度で出し分ける

<div class="background-switch"></div>

clean video ID for embedding

<?php
$yt_code = preg_replace( '/[^\d\w]/', '', $yt_code );

AJAX

<section class="section-news ajax-news">
    <div class="container">
        <div class="row ajax-result">

        <?php
        $news = new WP_Query(array(
            'post_type'         =>  'post',
            'posts_per_page'    =>  4
        ));
        if($news->have_posts()):
            $max_post_count = $news->post_count;

            while ($news->have_posts()):
                $news->the_post();
                // $thumb = wp_get_attachment_image_src( get_post_thumbnail

Posible problema Combine

menuPublisher.zip(searchPublisher)
            .map { menuItems in
                return NavigationBarState.menuLoaded(menuItems)
            }
            .subscribe(stateSubject)
            .store(in: &subscriptions)
            
            
en lugar de esto, sustituir por esto

menuPublisher.zip(searchPublisher)
            .map { menuItems in {
                return NavigationBarState.menuLoaded(menuItems)
            }
            .sink { [unowned self] event in
                self.sta

TS config

{
  "compilerOptions": {
    "experimentalDecorators": true,
    "module": "NodeNext",
    "moduleResolution": "Node",
    "noImplicitAny": true,
    "noImplicitReturns": true,
    "noImplicitThis": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "skipLibCheck": true,
    "strict": true,
    "strictFunctionTypes": true,
    "target": "ES2020"
  },
  "include": [
    "*.ts",
    "**/*.ts"
  ],
  "exclude": [
    "node_modules/*"
  ]
}

non www to www redirect

RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain.com [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [L,R=301]

【three.js】Z軸なびき画像アニメーション

<canvas id="myCanvas"></canvas>

Basics of Python for Coding

# Lists are indexed and ordered. 
# Therefore, they have O(N) complexity for element searching.

li = ['abc','def','ghi']

# Get number of occurences of an element in the list
li.count('abc')

# Sort the elements of the list
li.sort()                  # Ascending
li.sort(reverse=True)      # Descending

# Reverse the order of elements in the list
li.reverse()

# Reverse traversal of list
for x in reversed(li):
    print(x)

# Adding elements to List
li.append("jkl")

# Insert element at specifie

在旋转数组中查找一个数

旋转数组: [7,8,9,1,2,3,6]

思路:
判断 target 是否和 mid 在同一边,如果在同一边则进行二分查找。
否则:
* mid 在右边,target 在左边,则将 mid 值设置为 INT_MAX
* mid 在左边,target 在右边,则将 mid 值设置为 INT_MIN

注意临界条件

```C++
class Solution {
public:
  int search(vector<int> &nums, int target) {
    int left_index = 0, right_index = nums.size() - 1;
    while (left_index <= right_index) {
      int mid_index = (right_index - left_index) / 2 + left_index;
      int mid = (nums[mid_index] < nums[0]) == (target < nums[0])
                    ? nums[mid_ind