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'
}
@xiongchengqing
xiongchengqing / TypeChallenges.ts
Last active April 14, 2022 02:12
typescript lessons
// 11. 元组转换为对象
const tuple = ['tesla', 'model 3', 'model X', 'model Y'] as const
type TupleToObject<T extends readonly any[]> = {[P in T[number]]: P}
type result = TupleToObject<typeof tuple>
@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(() => {
{
"scripts": [],
"styles": []
}
{
"scripts": [],
"styles": []
}
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)) {
@xiongchengqing
xiongchengqing / macOS tips and tricks.md
Last active October 14, 2021 06:14
macOS tips and tricks

Q:如何在 spotlight 中快速打开文件所在位置?

按住 cmd 双击列表中的文件即可,也可以先选中列表中的文件再按组合键 cmd + R。选中某个文件按住 cmd 键,在预览侧底部会显示文件所在的路径。

screen_cast_reveal_file_with_shortcuts