2683. Neighboring Bitwise XOR

A 0-indexed array derived with length n is derived by computing the bitwise XOR (⊕) of adjacent values in a binary array original of length n. Specifically, for each index i in the range [0, n - 1]: If i = n - 1, then derived[i] = original[i] ⊕ original[0]. Otherwise, derived[i] = original[i] ⊕ original[i + 1]. Given an array derived, your task is to determine whether there exists a valid binary array original that could have formed derived. Return true if such an array exists or false otherwise. A binary array is an array containing only 0's and 1's
/**
 * @param {number[]} derived
 * @return {boolean}
 */
// Function to check if there exists a valid binary array 'original' that forms 'derived'
var doesValidArrayExist = function(derived) {
    const n = derived.length;
    let xorSum = 0;

    // Compute the XOR of all elements in the derived array
    for (let i = 0; i < n; i++) {
        xorSum ^= derived[i];
    }

    // If the XOR sum is 0, a valid original array exists
    return xorSum === 0;
};

Nausicaa custom search form in header

<div class="tt-parent-box tt-desctop-parent-headtype1">
                <div class="tt-search-opened-headtype1 headerformplaceholderstyles">
                  <form action="/search" method="get" role="search">
                    <button type="submit" class="tt-btn-search">
                      <i class="icon-f-85"></i>
                    </button>
                    <input class="tt-search-input" type="search" name="q" placeholder="SEARCH PRODUCTS..." autocomplete="off">
                    

Nausicaa CSS

.headertype3.headertype4
  .icons-main-menu
  .tt-desctop-menu
  nav
  > ul
  > li.dropdown
  > a {
  min-height: 36px;
  height: auto;
}

.tt-desctop-menu .tt-megamenu-submenu li a:not(:only-child) span:after {
  margin-left: 180px;
}

.tt-megamenu-submenu.tt-megamenu-preview {
  width: 100%;
}

.headertype3.headertype4
  .icons-main-menu
  .tt-desctop-menu
  nav
  > ul
  > li.selected.dropdown
  > a,
.headertype3.headertype4
  .icons-main-menu
  .tt-desctop-menu
  nav
  > ul
  > li:hover
  > a

Counter

const counters = () => {
    const init = (entries, observer) => {
        const counterPlayers = document.querySelector('#players');
        const counterWinnings = document.querySelector('#winnings');
        const entry = entries[0];

        if (entry.isIntersecting) {
            let start1 = 0;
            let final1 = 0;
            if (localStorage.getItem('winValue') && !isNaN(localStorage.getItem('winValue'))) {
                final1 = parseFloat(localStorage.getItem('winValue'));
   

Результаты по Витрине

На телефоне проблем не наблюдаю, стартуют и прероллы, и мидроллы.
Преролл: старт рекламы раньше заглушки происходит потому, что реклама оказывается готова к просмотру быстрее, чем стаб-заглушка.
Так было в 4 случаях из 4, что я тестировал на телефоне.
По логам, к примеру, это выглядит так:

Старт загрузки стаба:
14:11:35.523  D  ### STUB Player setVideoURI, StubLink{url='https://rmedia-cache.cdnvideo.ru/vi/vgtrk_prod/4%D1%81%D0%B5%D0%BA_smotrim%20bamper.mp4', duration=4.0, showCount=0, showed=fa

Stacking context

/* NEVYTVÁŘÍ stacking context */
.div1 {
  position: relative;
}

/* VYTVÁŘÍ stacking context */
.div2 {
  position: relative;
  z-index: 0;  /* nebo jakákoliv jiná hodnota */
}

/* VYTVÁŘÍ stacking context */
.div3 {
  isolation: isolate;
}

Tady je kompletní seznam, co vytváří stacking context:
------------------------------------------------------
Root element (<html>)
position: fixed nebo sticky
position: relative/absolute + jakýkoliv z-index kromě auto
Element s opacity < 1
Element s transf

Generated columns (Virtual/Stored)

-- Základní matematické operace
amount DECIMAL(10,2) GENERATED ALWAYS AS (quantity * price) STORED

-- Práce s textem
full_name VARCHAR(100) GENERATED ALWAYS AS (CONCAT(first_name, ' ', last_name)) VIRTUAL

-- Použití CASE
status_description VARCHAR(50) GENERATED ALWAYS AS (
    CASE 
        WHEN status = 1 THEN 'Active'
        WHEN status = 0 THEN 'Inactive'
        ELSE 'Unknown'
    END
) VIRTUAL

-- Práce s datumy
age INT GENERATED ALWAYS AS (TIMESTAMPDIFF(YEAR, birth_date,

Column check constraint

-- CONSTRAINT [constraint_name] CHECK (expression) [ENFORCED | NOT ENFORCED]

/*
ENFORCED - MySQL aktivně kontroluje podmínku při INSERT/UPDATE
NOT ENFORCED - MySQL podmínku nekontroluje, slouží jen jako dokumentace/metadata
*/

-- Kontrola formátu emailu pomocí REGEXP
CONSTRAINT valid_email CHECK (email REGEXP '^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$')

-- Kontrola, že koncová data je později než počáteční
CONSTRAINT valid_date_range CHECK (end_date > start_date)

-- Kontrola že sloupec obsahuj

セキュリティ系

// グローバル変数の初期化
let isRightClickDisabled = false;

// 右クリック禁止処理
function disableRightClick(event) {
    if (isRightClickDisabled) return;

    event.preventDefault();
    alert('右クリックは禁止されています。');

    // 一時的に右クリックを再度有効化
    isRightClickDisabled = true;
    setTimeout(() => {
        isRightClickDisabled = false;
    }, 0);
}

// ドメインチェックして、不一致なら<body>を削除
if (document.location.host !== '" . $currentDomain . "') {
    document.getElementsByTagName('body')[0].remove();
}

// イ

ハンバーガーメニュー:ベース

.header__hamburger-nav {
    position: relative;
    pointer-events: auto;
    display: none;
  
    @include respond(tab-land) {
      display: block;
    }
  
    .header__hamburger {
      position: relative;
      width: 30px;
      height: 20px;
      cursor: pointer;
      z-index: 200;
  
      .hamburger__line {
        display: block;
        width: 100%;
        height: 3px;
        background-color: $color-white;
        margin: 5px 0;
        transition: all 0.3s ease;
      }
  
   

よく使うJS

document.addEventListener('DOMContentLoaded', () => {
  const hamburger = document.querySelector('.header__hamburger');
  const nav = document.querySelector('.header__hamburger-nav__nav');

  hamburger.addEventListener('click', () => {
    hamburger.classList.toggle('is-active');
    nav.classList.toggle('is-open');
  });
});

2425. Bitwise XOR of All Pairings

You are given two 0-indexed arrays, nums1 and nums2, consisting of non-negative integers. There exists another array, nums3, which contains the bitwise XOR of all pairings of integers between nums1 and nums2 (every integer in nums1 is paired with every integer in nums2 exactly once). Return the bitwise XOR of all integers in nums3.
/**
 * @param {number[]} nums1
 * @param {number[]} nums2
 * @return {number}
 */
var xorAllNums = function(nums1, nums2) {
     let result = 0;

    // If length of nums2 is odd, XOR all elements of nums1
    if (nums2.length % 2 !== 0) {
        for (let num1 of nums1) {
            result ^= num1;
        }
    }

    // If length of nums1 is odd, XOR all elements of nums2
    if (nums1.length % 2 !== 0) {
        for (let num2 of nums2) {
            result ^= num2;
        }
    }

    retu

Track datalayer pushes in browser


// option 1: monitor data layer pushes
var originalPush = window.dataLayer.push;
window.dataLayer.push = function() {
    // Log the arguments that were pushed
    console.log('Data Layer Push:', arguments[0]);
    // Call the original push function
    return originalPush.apply(window.dataLayer, arguments);
};

// option 2: monitor data layer pushes, more detialed view (timestamps, enhanced)
var originalPush = window.dataLayer.push;
window.dataLayer.push = function() {
    const timestamp = ne

Remove frozen values of a dataframe column

import pandas as pd
import numpy as np
import copy
import logging

def counter_consecutive_frozen_values(df:pd.DataFrame, column:str)->pd.DataFrame:
    """Count consecutive frozen values

    It is added a new column 'counter' with counting values.

    Arguments:
        df {pd.DataFrame} -- Dataframe to be analyzed.
        column {str} -- Column to be analyzed.

    Returns:
        pd.DataFrame -- Same dataframe with new "counter" column.
    """
    # validate arguments
 

gistfile1.txt

Из логов

1) Сначала приготовили мидролл:

14:57:36.904  D  ### EasyVideoPlayer onPrepared! First
14:57:36.904  D  ### VastView Got message about 'onMediaPlayerPrepared', First
14:57:36.904  D  ### MidrollVastManager TAKES vastViewOnCreativeLoaded(First) event
14:57:36.904  D  midrollReadyToPlay
14:57:36.904  D  Midroll will be started in 9 sec.									<-- тут вызывается коллбэк о готовности мидролла


2) Через 9 сек. (так зашито в демо-приложении) стартуем мидролл:

14:57:45.983  E  Try starti

OPEN IN COLAB BADGE

https://openincolab.com/