2597. The Number of Beautiful Subsets

You are given an array nums of positive integers and a positive integer k. A subset of nums is beautiful if it does not contain two integers with an absolute difference equal to k. Return the number of non-empty beautiful subsets of the array nums. A subset of nums is an array that can be obtained by deleting some (possibly none) elements from nums. Two subsets are different if and only if the chosen indices to delete are different.
var beautifulSubsets = function(nums, k) {
    let result = 0;

    const isValid = (subSet, num) => {
        for (let i = 0; i < subSet.length; i++) {
            if (Math.abs(subSet[i] - num) === k) {
                return false;
            }
        }
        return true;
    };

    const dfs = (arr, remaining) => {
        if (remaining.length === 0) return;

        for (let i = 0; i < remaining.length; i++) {
            arr.push(remaining[i]);
            if (isValid(arr, remaining[i]

SHORTCODE: 'does-event-have-tickets'

/* will check if event has tickets or not
 * USAGE: [does-event-have-tickets]
 */
function shortcode__does_event_have_tickets() {
	global $post;
	
	$html = '0';
	if (tribe_events_has_tickets()) {
		$html = '1';
	}
	return $html;
}
add_shortcode( 'does-event-have-tickets', 'shortcode__does_event_have_tickets' );

Matrix Accordion

Accordion that has 1st tab active on load, and only allows 1 active tab.
<div class="pp-accordion">
  <div class="section-copy">{{Module.FieldValues.SectionCopy}}</div>
  <ul class="accordion-list">
    {% for Item in List.Items %}
      <li class="accordion-single {% if forloop.index == 1 %}active{% endif %}">
        <h3 class="accordion-title">
          <span>{{Item.FieldValues.Title}}</span>
          <span class="accordion-close-icon"></span>
        </h3>
        <div class="accordion-copy">{{Item.FieldValues.Copy}}</div>
      </li>
    {% endfor %

Matrix Accordion

Accordion that has 1st tab active on load, and only allows 1 active tab.
<div class="pp-accordion">
  <div class="section-copy">{{Module.FieldValues.SectionCopy}}</div>
  <ul class="accordion-list">
    {% for Item in List.Items %}
      <li class="accordion-single {% if forloop.index == 1 %}active{% endif %}">
        <h3 class="accordion-title">
          <span>{{Item.FieldValues.Title}}</span>
          <span class="accordion-close-icon"></span>
        </h3>
        <div class="accordion-copy">{{Item.FieldValues.Copy}}</div>
      </li>
    {% endfor %

Cosine similarity

Formula

https://en.wikipedia.org/wiki/Cosine_similarity#:~:text=Cosine%20similarity%20is%20the%20cosine,but%20only%20on%20their%20angle.
 
Vectors:

A = [1 2 3], B = [4 5 6]

1. Dot product:
 A⋅B=1⋅4+2⋅5+3⋅6=4+10+18=32
 
2. Magnitude each vector:
 ||A|| =  raiz(1^2 + 2^2 + 3^2) => raiz(1 + 4 + 9) => raiz(14)
 ||B|| =  raiz(4^2 + 5^2 + 6^2) => raiz(16 + 25 + 36) => raiz(77)
 
3. Cosine similarity:

 cos(0) = 32 / raiz(14) * raiz(44) => 32 / raiz(1078)
 
Simplify further

 cos(0) = 32 / 32.836 =>

objectMergeDeep | object Merge Deep assign

export function objectMergeDeep(target, source) {
  Object.keys(source).forEach(key => {
    const targetValue = target[key];
    const sourceValue = source[key];

    if (typeof sourceValue === 'object' && sourceValue !== null) {
      if (typeof targetValue === 'object' && targetValue !== null) {
        objectMergeDeep(targetValue, sourceValue);
      } else {
        target[key] = (Array.isArray(sourceValue)) ? [] : {};
        objectMergeDeep(target[key], sourceValue);
      }
    } else {

objectUpdateNested | object Update Nested Objects (обновление существующих и несуществующих подобъектов объекта)

export function objectUpdateNested(obj, pathAndValue) {
  let current = obj;

  const value = pathAndValue.pop();

  for (let i = 0; i < pathAndValue.length - 1; i++) {
    if (typeof current[pathAndValue[i]] !== 'object' || current[pathAndValue[i]] === null) {
      current[pathAndValue[i]] = {};
    }
    current = current[pathAndValue[i]];
  }
  current[pathAndValue[pathAndValue.length - 1]] = value;
}

LocalStorageManager js class

export default class LocalStorageManager {
  constructor() {
    this.prefix = ""
  }

  setPrefix(newPrefix) {
    this.prefix = newPrefix
  }

  removeLocalStorage(name) {
    localStorage.removeItem(this.prefix + name)
  }

  getLocalStorage(name) {
    return localStorage.getItem(this.prefix + name)
  }

  clearLocalStorage() {
    Object.keys(localStorage).forEach(key => {
      if (key.startsWith(this.prefix)) {
        localStorage.removeItem(key)
      }
    })
  }

  setLocalStorage(nam

[Python] ブラウザを開いてログイン処理を行う

import time
import traceback
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
from selenium.common.exceptions import WebDriverException
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By

def login():
    # Chromeブラウザでページを開く
    driver.get('http://localhost/wp-login.php')

    #

[Python] URLリストの各ページから値を取得する(ログイン無し)

import requests
import csv
from bs4 import BeautifulSoup

class FixedDict(dict):
    def __init__(self, initial_data):
        super().__init__(initial_data)

    def __setitem__(self, key, value):
        if key in self:
            super().__setitem__(key, value)
        else:
            raise KeyError(f"追加操作は許可されていません: {key}")

    def __delitem__(self, key):
        raise KeyError(f"削除操作は許可されていません: {key}")

# CSVカラムの初期化用データ
csv_columns = FixedDict({
    'Title': '',
    

loan term calculations

with cte_details as (select 
    l.loan_pro_loan_id          as loan_id, 
	l.loan_effective_date       as origination_date, 
	app.application_id          as application_id, 
	sp.payment_date             as payment_date
from dw_reporting_bsf_uwp.scheduled_payment sp
join dw_reporting_bsf_origination.application app on sp.loan_contract_calculation_id = app.selected_loan_contract_calculation_id
left join dw_reporting_bsf_identity.loan l on app.application_id = l.application_id and upper(l.asserted)

to review

'select * from demog_status ds join chain_main cm 
on ds.cur_chain=cm.chain_id where lset_id=10 
and cm.size>11 and not lsets @> (select array_agg(lset_id) 
from link_set where name='\''DEATH'\'');'

Trigger AWS Lambda

function test() {
  const accessKeyId = '';
  const secretAccessKey = '';
  const region = 'eu-central-1';
  const aws = new AWS(accessKeyId, secretAccessKey, region);
  const lambdaARN = '';
  const payload = JSON.stringify({
    "file_id": "",
    "folder_id": "",
    "language": "en",
    "webhook": "https://webhook.site/d03096bf-e1a0-4cc3-9743-17fa20f30bda",
    "person": "juan@healthforce.ai"
  });
  aws.invokeLambdaAsync(lambdaARN, payload);
}

class AWS {
  constructor(accessKeyId, secret

Forminator ajax helper

Helps forminaor form using ajax to load faster
//Help forminator form to load faster using ajax
function wpmudev_forminator_ajax_load_without_nonce() {
	$_POST[ 'nonce' ] = wp_create_nonce( 'forminator_load_module' );
}
add_action( 'wp_ajax_forminator_load_form', 'wpmudev_forminator_ajax_load_without_nonce' );
add_action( 'wp_ajax_nopriv_forminator_load_form', 'wpmudev_forminator_ajax_load_without_nonce' );

131. Palindrome Partitioning

Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s.
/**
 * @param {string} s
 * @return {string[][]}
 */
var partition = function(s) {
    let res = [];
    backtrack(s, 0, [], res);
    return res;
};

function backtrack(s, start, path, res) {
    // If we've gone through every character in the string, add the path to the result
    if (start === s.length) {
        res.push(Array.from(path));
        return;
    }

    for (let end = start; end < s.length; end++) {
        // If the substring from start to end is a palindrone, add it to the pat

Footer Signature

<span style="color: #ffffff;"><a style="color: #ffffff;" href="https://doitxugj.elementor.cloud/">Shine Aesthetics by Leslie</a></span>. All Rights Reserved.<br /><a style="color: #ffffff;text-decoration:underline;" href="https://doitxugj.elementor.cloud/terms-and-conditions">Terms and Conditions</a>. <a style="color: #ffffff;text-decoration:underline;" href="https://doitxugj.elementor.cloud/privacy-policy">Privacy Policy</a>.<br />Site by <a target="_blank" href="https://askewdigital.com"><img