Jest MockFn

fakeFilesService = {
    readDirectory: jest.fn(),
    uploadFile: jest.fn()
};
fakeFiles = ['sweet', 'emotion'];
fakeFilesService.readDirectory.mockResolvedValue(fakeFiles);
fakeFilesService.uploadFile.mockResolvedValue();

Jest ObjectContaining

expect(fakeResponse.send).toHaveBeenCalledWith(
    expect.objectContaining({
        message: 'Please upload a file!'
    })
);

test

test

SocketClass.ts

import { io as socketIo, Socket } from 'socket.io-client'
import { API_SOCKET_URL } from '@/constants/config'
export type TEvent<T> = {
  id: string
  event: string
  initialData?: boolean
  reconnect?: boolean
  onResponse: (data: T) => void
  onDisconnect?: () => void
}
type TUnsubscribe = {
  id: string
  event: string
}
const EVENT = (event: string) => ({ room: event })
class SocketClass {
  private io?: Socket
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
  private events

while循环,多分支-初级代码测试

TheNumberOf =  0            #赋值TheNumberOf等于0
while TheNumberOf != 6:     #循环的条件是:TheNumberOf不等于6
    if TheNumberOf == 5:    #如果TheNumberOf等于5
        print('游戏将在下一次结束')
        pass
    import random           #导入随机数
    ceshi=int(input("请选择:【0:石头, 1剪刀, 2布】"))
    computer=random.randint(0,2)    #计算机出拳的随机数为(0-2),0,1,2都可以
    print ('计算机出拳:%d'%computer)
    if ceshi==0 and computer==1:
        print('恭喜,你赢了')
    if ceshi==0 and computer==2:
        print('抱歉,你输了')
    if ceshi==1 

Notion修复

进入后空白,无响应,解决方式:
1.删除C:\Users\NET-LE\AppData\Roaming\Notion文件夹
2.如若上面的办法还是不行,从其它电脑拷贝C:\Users\用户名\AppData\Roaming\Notion替换当前该系统文件夹

CSS Clamp builder (responsive fluid typography)

// https://css-tricks.com/linearly-scale-font-size-with-css-clamp-based-on-the-viewport/#for-those-who-dont-mind-that-edge-case
// https://royalfig.github.io/fluid-typography-calculator/
// https://fluid-typography.netlify.app/

function clampBuilder( minWidthPx, maxWidthPx, minFontSize, maxFontSize ) {
  const root = document.querySelector( "html" );
  const pixelsPerRem = Number( getComputedStyle( root ).fontSize.slice( 0,-2 ) );

  const minWidth = minWidthPx / pixelsPerRem;
  const 

SKU功能

### [电商最小存货 - SKU 和 算法实现](https://juejin.cn/post/7002746459456176158)
### [电商平台商品 SKU 组合查询算法实现](https://hooray.github.io/posts/8b2bd6f8/)
### [淘宝SKU组合查询算法实现](https://blog.csdn.net/rosanu_blog/article/details/49836575)

CPT - Referenzen Custom Post Type Referenzen

if ( ! function_exists('custom_referenzen') ) {

// Register Custom Post Type
function custom_referenzen() {

	$labels = array(
		'name'                  => _x( 'Referenzen', 'Post Type General Name', 'vogt' ),
		'singular_name'         => _x( 'Referenz', 'Post Type Singular Name', 'vogt' ),
		'menu_name'             => __( 'Referenzen', 'vogt' ),
		'name_admin_bar'        => __( 'Referenzen', 'vogt' ),
		'archives'              => __( 'Referenz Archiv', 'vogt' ),
		'attributes'      

Test Runner

from django.db import connection
from django.test.runner import DiscoverRunner
from django.apps import apps


class ManagedModelTestRunner(DiscoverRunner):
    """
    Test runner that automatically makes all unmanaged models in your Django
    project managed for the duration of the test run, so that one doesn't need
    to execute the SQL manually to create them.
    """

    def setup_databases(self, **kwargs):
        self.unmanaged_models = [model for model in apps.get_models() if not model

scrollItem(GSAP)

<script setup>
import { gsap } from 'gsap'
import { ScrollTrigger } from 'gsap/ScrollTrigger'

gsap.registerPlugin(ScrollTrigger)

function scrollItem() {
  gsap.utils.toArray('.fadeInRight').forEach((el) => {
    gsap.from(el, {
      x: 100,
      opacity: 0,
      duration: 1.5,
      ease: 'power4.out',
      // スクロールトリガーの設定
      scrollTrigger: {
        trigger: el // 対象物
      }
    })
  })
}

onMounted(() => {
  scrollItem()
})
</script>

Medium 筆記

Medium 筆記
<!-- About table -->

<div class="table-wrap">
<table>
<caption>Assets</caption>
<!-- 用thead建立主題及標籤 -->
            <thead>
              <tr>
                <td></td>
<!-- 用th建立thead內的標籤 -->
                <th><span class="sr-only year">2019</span></th>
                <th><span class="sr-only year">2020</span></th>
                <th class="current"><span class="sr-only year">2021</span></th>
              </tr>
            </thead>
<!-- 用tbody建立副標及標籤以下子項目 -->
            <tbody>
<!-- 用tr建立

if else elif代码片段-初级

Ceshi = int (input('请输入:'))
if Ceshi <10:
    print('结果小于10')
    pass

elif Ceshi == 10:
    print('结果=10')
    pass

elif Ceshi > 10:
    print('结果大于10')

else :
    print('输入错误,请输入数据:')

Fast fill array

const newData = Array(20)
      .fill(0)
      .map((_, index) =>  index++);

while 循环代码测试

#while 循环代码-初级测试
m = int (input('请输入你的号码:'))
n = 1
while m!=5 :
    if n==5:
        print('输入次数已经达到最大')
        break
    if m == 5:
        print('a=100')
        break
    else:
        m = int(input('请输入你的号码:'))
        print(n)
        n=n+1

XmlSerializerHelper

https://gitee.com/dayrl/Utility/blob/master/XmlSerializerHelper.cs#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Runtime.Serialization.Json;
using System.Xml;
using System.Xml.Serialization;
using System.Drawing.Imaging;
using System.Drawing;

/********************************************************************
	created:	2017/03/08
	filename: 	XmlSerializerHelper.cs
	file path:	    StampTool
	file base:	XmlSerializerHelper
	file ext:	    cs
	author:		ZDD
	purpose:	XML File