Skip to content

Instantly share code, notes, and snippets.

View xiongchengqing's full-sized avatar
🇨🇳
Never stop learning

Xiong,Cheng-Qing xiongchengqing

🇨🇳
Never stop learning
View GitHub Profile
@xiongchengqing
xiongchengqing / LICENSE.md
Created December 30, 2022 01:55 — forked from sj26/LICENSE.md
Bash retry function

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit

OS=`echo \`uname\` | tr '[:upper:]' '[:lower:]'`
AURL="https://gist.githubusercontent.com/hightemp/5071909/raw/"
ANAME=".bash_aliases"
TMPAPATH="/tmp/$ANAME"
HOMEAPATH="~/$ANAME"
[ "$OS" = "windowsnt" ] && OS_WIN="yes"
[ "$OS" = "darwin" ] && OS_MAC="yes"
[ "$OS" = "linux" ] && OS_LIN="yes"
@xiongchengqing
xiongchengqing / codeswing.json
Last active June 1, 2022 01:57
diagonal-fill-css
{
"scripts": [],
"styles": []
}
@xiongchengqing
xiongchengqing / App.vue
Created April 14, 2022 12:09
vue3-slot-access
<template>
<p>{{ greeting }} World!</p>
</template>
<script>
export default {
data() {
return {
greeting: 'Hello'
}
{
"scripts": [],
"styles": []
}
{
"scripts": [],
"styles": []
}
@xiongchengqing
xiongchengqing / batch-process-message.js
Last active March 14, 2022 03:38
microtask application
// 1. The most common reason for using queueMicrotask() is to create consistent ordering
// 2. Batch processing is a common use case
const messageQueue = [];
const sendMessage = message => {
messageQueue.push(message);
if (messageQueue.length === 1) {
queueMicrotask(() => {
import mergeWith from 'lodash/mergeWith'
const m1 = { a: 1, b: 2 }
const m2 = { a: 9, c: 3 }
const m3 = { a: 4, b: 5, d: 7 }
// Lodash version
// merge objects with customizer
mergeWith(m1, m2, m3, (objValue, srcValue, key, object) => {
if (Object.prototype.hasOwnProperty.call(object, key)) {
{
"scripts": [],
"styles": []
}
@xiongchengqing
xiongchengqing / mapValues.ts
Last active September 17, 2021 06:44 — forked from steveruizok/mapValues.ts
Map values.
/**
* 外提
*
* @param obj
* @param fn
* @returns remapped obj
*/
export function remap<P, T>(
obj: { [key: string]: T },
fn: (value: T, index: number) => P