Split JSON string from Data Cloud

When a Data Cloud segment is created and holding values from related objects, these values are combined in one column and send to a Marketing Cloud Shared Data Extension. Before you can use these values in your MC campaign, that JSON string first needs to be separated into new columns. You can use SQL for that. Below SQL is an example that you can use to split a field. In below example the column name is Agreement_ZB.
SELECT 
    a.[SubscriberKey], 
    JSON_VALUE(b.[Agreement_ZB],'$.items[1].soco_Destination_lookup_c') AS soco_Destination_lookup_c,
    JSON_VALUE(b.[Agreement_ZB],'$.items[1].soco_Amount_c') AS soco_Amount_c,
    JSON_VALUE(b.[Agreement_ZB],'$.items[1].soco_Frequency_c') AS soco_Frequency_c,
    JSON_VALUE(b.[Agreement_ZB],'$.items[1].Soco_start_date') AS Soco_start_date,
    JSON_VALUE(b.[Agreement_ZB],'$.items[1].Agreement_ZB-Id') AS Agreement_ZB_Id,
    JSON_VALUE(b.[Agreement_ZB],'$.items

SETUP LOGGING

import logging

# Set up logging
logger = logging.getLogger(__name__)    # create a logger
logger.propagate = False                          # Add this line
logger.setLevel(logging.DEBUG)                # set logging level
logger.handlers.clear()                               # Add this before adding your new handler  
handler = logging.StreamHandler()           # Create a console handler
# set the logging format
formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
handler.

gsap (タイプライターのように文字を1文字ずつ表示)

gsap.registerPlugin(ScrollTrigger);
gsap.registerPlugin(TextPlugin);

const title = document.querySelectorAll(".js-title");
// console.log(title);

title.forEach((el) => {
  const spanText = el.innerText;

  gsap.set(el, {
    text: {
      // value: spanText,
      newClass: "cursor-active",
    },
    opacity: 0,
  });

  const tl = gsap.timeline({ paused: true });

  tl.to(el, {
    opacity: 1,
    duration: 0, // opacityを瞬時に表示させる
  })
    .to(el, {
      delay: 1,
  

smoothScroll

export default function () {
  const initializeSmoothScroll = () => {
    document.addEventListener("click", handleClick, { capture: true });
  };

  const getHeaderBlockSize = () => {
    const header = document.querySelector("[data-fixed-header]");
    if (!header) {
      return 0;
    }
    const { position, blockSize } = window.getComputedStyle(header);
    const isFixed = position == "fixed" || position === "sticky";
    return isFixed ? parseFloat(blockSize) : 0;
  };

  //

validation

export default function validateContactForm() {
  document.addEventListener("DOMContentLoaded", function () {
    const contactForm = document.getElementById("contactForm");
    const tel = document.getElementById("tel");
    const email = document.getElementById("email");

    // エラーメッセージの生成
    const errorMsg = (el, error) => {
      const newSpan = document.createElement("span");
      newSpan.classList.add("is-error");
      newSpan.textContent = error;
      el.parentNode.appendC

scrollObserver

export default class ScrollObserver {
  constructor(els, cd, options) {
    this.els = document.querySelectorAll(els);
    const defaultOptions = {
      root: null,
      rootMargin: "0% 0% -240px",
      threshold: [0, 0.5, 1.0],
      once: true,
      readyClass: "is-inviewReady",
      activeRootClass: false,
    };
    this.cd = cd;
    this.options = Object.assign(defaultOptions, options);
    this.once = this.options.once;
    this.readyClass = this.options.readyClass;
   

Loading

export default class Loading {
  constructor(options) {
    this.timeoutId;

    this.defaultOptions = {
      isJS: true,
      isLoad: true,
      isIos: true,
      isResize: true,
      introSelector: ".js-intro",
      targetSelector: "html",
    };

    this.options = Object.assign(this.defaultOptions, options);
    this.introElem = document.querySelector(this.options.introSelector);
    this.targetElem = document.querySelector(this.options.targetSelector);

    if (!this.

IntersectionObserver

export default function () {
  const contents = document.querySelectorAll(".js-content");
  // console.log(contents);

  const options = {
    root: null,
    rootMargin: "-50% 0px",
    threshold: 0,
  };

  //インスタンスを作成。要素が交差するたびに doWhenIntersect 関数を呼び出す
  const observer = new IntersectionObserver(doWhenIntersect, options);

  //.js-contentの監視を開始
  contents.forEach((content) => {
    observer.observe(content);
  });

  //交差したときに呼び出す関数
  function doWhenIntersect(entries) {
  

accordion

export default function () {
  document.addEventListener("DOMContentLoaded", () => {
    setUpAccordion(
      ".js-accordion__sm1",
      ".js-accordion__items__sm1",
      ".js-accordion__box__sm1",
      animTiming1,
      animTiming1
    );
    setUpAccordion(
      ".js-accordion__sm2",
      ".js-accordion__items__sm2",
      ".js-accordion__box__sm2",
      animTiming2,
      animTiming2
    );
    setUpAccordion(
      ".js-accordion__lg1",
      ".js-accordion__items__

gsap scrollTrigger

import { gsap } from "gsap";
import { ScrollTrigger } from "gsap/ScrollTrigger";
import { ScrollToPlugin } from "gsap/ScrollToPlugin";
gsap.registerPlugin(ScrollTrigger, ScrollToPlugin);

export default function () {
  const windowSize = gsap.matchMedia();

  //タイトル アニメーション(小)
  const title_sm = gsap.utils.toArray(".js-title-sm");

  title_sm.forEach((spanToUp_sm) => {
    const textContent = spanToUp_sm.textContent;
    const wrapSpanTitle = [...textContent].map((char) => `<span>${

Laravel Fortify の仕組みを読み解く

# スタブ

Fortifyを有効化したときに公開されるファイルたち。  

## laravel/fortify/stub

|ファイル名|公開先|説明|
|---|---|---|
|fortify.php                     |config/fortify.php                          |Fortifyの設定ファイル。|
|FortifyServiceProvider.php      |app/Providers/FortifyServiceProvider.php    |Fortifyのサービスプロバイダー。Fortifyに関わるファイルの登録などを行う。|
|CreateNewUser.php               |app/Actions/CreateNewUser.php               |会員情報登録のアクション。|
|UpdateUserProfileInformation.php|app/Actions/UpdateUserProfileInformation.php|会員情

Cloud Control

async function getOrganizationArn(client: CloudControlClient): Promise<string> {
  try {
    const input: ListResourcesCommandInput = {
      TypeName: "AWS::Organizations::Organization"
    };

    const response = await client.send(new ListResourcesCommand(input));

    if (!response.ResourceDescriptions || response.ResourceDescriptions.length === 0) {
      throw new Error('No Organization found');
    }
    const orgProperties = JSON.parse(response.ResourceDescriptions[0].Properties ?? "{}")

miva_array_merge Example

<!-- Populate Source array -->
<mvt:capture variable="l.outfit_products_json">
[
    {
        "name": "Hat",
        "color": "Black",
        "price": 19.99
    },
    {
        "name": "T-Shirt",
        "color": "Blue",
        "price": 14.99
    },
    {
        "name": "T-Shirt",
        "color": "Blue",
        "price": 15.99
    },
    {
        "name": "Pants",
        "color": "Blue",
        "price": 39.99
    },
    {
        "name": "Socks",
        "color":

2657. Find the Prefix Common Array of Two Arrays

You are given two 0-indexed integer permutations A and B of length n. A prefix common array of A and B is an array C such that C[i] is equal to the count of numbers that are present at or before the index i in both A and B. Return the prefix common array of A and B. A sequence of n integers is called a permutation if it contains all integers from 1 to n exactly once.
/**
 * @param {number[]} A
 * @param {number[]} B
 * @return {number[]}
 */
var findThePrefixCommonArray = function(A, B) {
    const n = A.length;
    const C = new Array(n).fill(0);

    // To keep track of elements in the prefixes of A and B
    const setA = new Set();
    const setB = new Set();

    for (let i = 0; i < n; i++) {
        // Add the current elements to the respective sets
        setA.add(A[i]);
        setB.add(B[i]);

        // Count commom elements in both sets
        le

postgres_learning

https://www.depesz.com/
check this site for first and last

3223. Minimum Length of String After Operations

You are given a string s. You can perform the following process on s any number of times: Choose an index i in the string such that there is at least one character to the left of index i that is equal to s[i], and at least one character to the right that is also equal to s[i]. Delete the closest character to the left of index i that is equal to s[i]. Delete the closest character to the right of index i that is equal to s[i]. Return the minimum length of the final string s that you can achieve.
/**
 * @param {string} s
 * @return {number}
 */
var minimumLength = function(s) {
     // Create an object to count the frequency of each character in the string
    const charObj = {};

    // Iterate through each character in the string
    for (let i = 0; i < s.length; i++) {
        // If the character exists in the object, increment its count, otherwise set it to 1
        charObj[s[i]] = (charObj[s[i]] || 0) + 1;
    }

    // Initialize the answer to 0
    let answer = 0;

    // Iterate