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 childProcess = require('child_process'); | |
childProcess.exec(`start http://localhost:${env.port}`); |
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
### macOS Catalina: “App is damaged and can't be opened. You should move it to the trash.” | |
``` | |
sudo xattr -rd com.apple.quarantine '/Applications/Navicat Premium.app' | |
``` |
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 requestAnimFrame = (function() { | |
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(callback) { | |
return window.setTimeout(callback, 1000 / 60, (new Date).getTime()) | |
}; | |
})(); | |
const cancelAnimFrame = function() { | |
return window.cancelAnimationFrame || window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame || function(id) { | |
clearTimeout(id); | |
}; | |
}(); |
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
document.body.addEventListener('lazyImg', function(e) { | |
loadImgs(e.detail.container); | |
}, false); | |
document.body.dispatchEvent(new CustomEvent('lazyImg', { | |
detail: { | |
container: document.querySelector('.dropdown'), | |
force: true | |
} | |
})); |
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 getClearUrl(url) { | |
if (url.includes('?') || url.includes('#')) { | |
return (url.match(/^.*?(?=[?|#])/))[0]; | |
} else { | |
return url; | |
} | |
} | |
function getSearch(url: string): string { | |
let search: string = ''; |
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 downloadFileAsync(url, dest) { | |
return new Promise((resolve, reject) => { | |
const file = fs.createWriteStream(dest); | |
http.get(url, (res) => { | |
if (res.statusCode !== 200) { | |
reject(response.statusCode); | |
return; | |
} |
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
nrm 是一个 npm 源管理器,允许你快速地在 npm源间切换。 | |
## 安装: | |
```shell | |
npm install -g nrm | |
``` | |
## 使用 | |
### 查看可选源(带*号即为当前使用源) | |
```shell |
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
/*fixed元素*/ | |
.is-fixed { | |
position: static !important; | |
display:none; | |
} | |
/*专栏页头*/ | |
.ColumnPageHeader-Wrapper { | |
display:none; | |
} | |
/*头部logo*/ |
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 a = document.createElement('a'); | |
a.setAttribute('href', 'https://www.baidu.com'); | |
a.setAttribute('target', '_blank'); | |
document.body.appendChild(a); | |
a.click(); | |
a.parentNode && a.parentNode.removeChild(a); |
OlderNewer