This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const reg=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git tag -d $(git tag --points-at HEAD) # 删除当前commit上的tag | |
git tag -d $(git tag -l) # 删除全部 | |
git push origin --delete $(git tag -l) # 删除远端 | |
# 参考 https://stackoverflow.com/questions/44702757/how-to-remove-all-git-origin-and-local-tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template lang="pug"> | |
div | |
ABC(:value="value" @input="onUpdateVisible") // 将v-model 改为 :value和input事件处理 (value和input是默认情况,ABC内组件能通过model配置项修改) | |
</template> | |
<script> | |
export default { | |
components: { | |
ABC, | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_.union([1,2,3],[2,3,4]) // [1,2,3,4] 并集 | |
_.intersection([1,2,3],[2,3,4]) // [2,3] 交集 | |
_.xor([1,2,3],[2,3,4]) // [1,4] | |
_.difference([1,2,3],[2,3,4]) // [1] 差集 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getCoords(elem) { // crossbrowser version | |
var box = elem.getBoundingClientRect(); | |
var body = document.body; | |
var docEl = document.documentElement; | |
var scrollTop = window.pageYOffset || docEl.scrollTop || body.scrollTop; // 获得整个页面已经滚动的距离 | |
var scrollLeft = window.pageXOffset || docEl.scrollLeft || body.scrollLeft; | |
var clientTop = docEl.clientTop || body.clientTop || 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
command1 && command2 # 串行执行 | |
command1 & command2 #并行 | |
wait #等待所有进程执行完成 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@each $height in 10,20,30,40,50,100,200{ | |
height#{$height}{ | |
height:$height; | |
} | |
} | |
@each $borderColor in red,blue,yellow,orange,black{ | |
border-#{$borderColor}{ | |
border:1px solid $borderColor; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getVariableName(unknownVariableInAHash){ | |
return Object.keys(unknownVariableInAHash)[0] | |
} | |
const foo = 42 | |
const bar = 'baz' | |
console.log(getVariableName({foo})) //returns string "foo" | |
console.log(getVariableName({bar})) //returns string "bar" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"title": "Mouse buttons 3,4,5 -> cut, paste, copy", | |
"rules": [ | |
{ | |
"description": "Maps button 5 to copy, 4 to paste, and 3 to cut to clipboard", | |
"manipulators": [ | |
{ | |
"type": "basic", | |
"from": { | |
"pointing_button": "button4" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function timeout(funct, args, time) { | |
var deferred = new jQuery.Deferred(), | |
promise = funct.apply(null, args); | |
if (promise) { | |
$.when(promise) | |
.done(deferred.resolve) | |
.fail(deferred.reject) | |
.progress(deferred.notify); | |
} |