Skip to content

Instantly share code, notes, and snippets.

@lichenbuliren
lichenbuliren / git-submodule-crud
Created September 14, 2021 02:07
resolve submodule conflict
# 解决子模块冲突问题
git submodule foreach git reset --hard HEAD
git submodule update
git submodule foreach "git checkout master; git pull"
git submodule foreach git clean -f
@lichenbuliren
lichenbuliren / create-reducer-action-types
Created September 14, 2021 02:06
dynamic create reducer actions by enum action type
type CreateActionMap<M extends { [index: string]: any }> = {
// 通过 extends undefined 来判断是否有 payload 要求
[Key in keyof M]: M[Key] extends undefined
? {
type: Key;
}
: {
type: Key;
payload: M[Key];
};
@lichenbuliren
lichenbuliren / cloudSettings
Last active July 30, 2021 08:58
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-07-30T08:58:05.702Z","extensionVersion":"v3.4.3"}
@lichenbuliren
lichenbuliren / GitConfigHttpProxy.md
Created September 13, 2019 01:42 — forked from evantoli/GitConfigHttpProxy.md
Configure Git to use a proxy

Configure Git to use a proxy

In Brief

You may need to configure a proxy server if you're having trouble cloning or fetching from a remote repository or getting an error like unable to access '...' Couldn't resolve host '...'.

Consider something like:

showFile(blob){
// It is necessary to create a new blob object with mime-type explicitly set
// otherwise only Chrome works like it should
var newBlob = new Blob([blob], {type: "application/pdf"})
// IE doesn't allow using a blob object directly as link href
// instead it is necessary to use msSaveOrOpenBlob
if (window.navigator && window.navigator.msSaveOrOpenBlob) {
window.navigator.msSaveOrOpenBlob(newBlob);
return;
@lichenbuliren
lichenbuliren / git-helper
Created May 12, 2017 02:49
git 相关操作技巧收纳
## 获取最新一次提交的文件改动列表
git log --name-only --pretty="" -1 || git show --name-only --pretty="" -1;
@lichenbuliren
lichenbuliren / git_toturial
Created May 12, 2017 02:36 — forked from guweigang/git_toturial
git命令大全
git init # 初始化本地git仓库(创建新仓库)
git config --global user.name "xxx" # 配置用户名
git config --global user.email "xxx@xxx.com" # 配置邮件
git config --global color.ui true # git status等命令自动着色
git config --global color.status auto
git config --global color.diff auto
git config --global color.branch auto
git config --global color.interactive auto
git config --global --unset http.proxy # remove proxy configuration on git
git clone git+ssh://git@192.168.53.168/VT.git # clone远程仓库
@lichenbuliren
lichenbuliren / check-preload.js
Created April 28, 2017 02:56
监测浏览器是否支持 Link preload 方案
var DOMTokenListSupports = function(tokenList, token) {
if (!tokenList || !tokenList.supports) {
return;
}
try {
return tokenList.supports(token);
} catch (e) {
if (e instanceof TypeError) {
console.log("The DOMTokenList doesn't have a supported tokens list");
} else {
@lichenbuliren
lichenbuliren / tree.js
Created April 27, 2017 15:57
常见数据结构遍历
var data = {
id: 1,
name: 'first',
children: [{
id: 2,
name: 'first-1',
children: false
}, {
id: 3,
name: 'first-2',
@lichenbuliren
lichenbuliren / cloudSettings
Last active July 2, 2019 13:44
Visual Studio Code Sync Settings Gist
{"lastUpload":"2017-06-12T01:47:48.469Z","extensionVersion":"v2.8.1"}