- remove unused remote branches to local
git fetch origin --prune
- remove unused remote tags to local
git fetch --prune --prune-tags origin
"editor.tokenColorCustomizations": { | |
"textMateRules": [ | |
{ | |
"name": "Attributes", | |
"scope": "entity.other.attribute-name", | |
"settings": { | |
"fontStyle": "italic" | |
} | |
}, | |
{ |
const getURLParameters = url => | |
(url.match(/([^?=&]+)(=([^&]*))/g) || []).reduce( | |
(a, v) => ((a[v.slice(0, v.indexOf('='))] = v.slice(v.indexOf('=') + 1)), a), | |
{} | |
); | |
function extractRootDomain(d) { | |
return /^([\d.]+|[a-z-]+)$/.test(d) ? d : d.split('.').slice(-2).join('.') | |
} |
let previousOverflow | |
let previousPaddingRight | |
/** | |
* Toggle the body scroll / overflow and additional styling | |
* necessary to preserve scroll position and body width (scrollbar replacement) | |
* | |
* @param {boolean} preventScroll - whether or not to prevent body scrolling | |
*/ | |
export default function preventBodyScroll(preventScroll) { |
function truncateNumber(num, digits = 0) { | |
const si = [ | |
{ value: 1, symbol: '' }, | |
{ value: 1e3, symbol: 'k' }, | |
{ value: 1e6, symbol: 'M' }, | |
{ value: 1e9, symbol: 'G' }, | |
{ value: 1e12, symbol: 'T' }, | |
{ value: 1e15, symbol: 'P' }, | |
{ value: 1e18, symbol: 'E' } | |
] |
const appendCopyrightToLivenews = e => { | |
const crText = `\r\n\r\n链接:${ | |
location.origin | |
}\r\n非商业转载请注明出处。` | |
e.preventDefault() | |
e.clipboardData.setData('Text', window.getSelection() + crText) | |
} | |
document.addEventListener('copy', appendCopyrightToLivenews) |
git fetch origin --prune
git fetch --prune --prune-tags origin
export function popupUrlCenterWindow(url, title, w, h) { | |
const dualScreenLeft = | |
window.screenLeft != undefined ? window.screenLeft : window.screenX | |
const dualScreenTop = | |
window.screenTop != undefined ? window.screenTop : window.screenY | |
const width = window.innerWidth | |
? window.innerWidth | |
: document.documentElement.clientWidth | |
? document.documentElement.clientWidth |
// mobile phone numbers in china | |
const reg = /^1(?:3\d|4[4-9]|5[0-35-9]|6[67]|7[013-8]|8\d|9\d)\d{8}$/ | |
// image tag | |
const regex = /<img([\s\S]*?)src\s*=\s*(['"])([\s\S]*?)\2([^>]*)>/gi | |
// only chinese charactors and letters | |
const regex = /^[\u4e00-\u9fa5a-zA-Z]+$/ | |
// 屏幕可视窗口大小 | |
window.innerHeight // 标准浏览器及IE9+ | |
document.documentElement.clientHeight // 标准浏览器及低版本IE标准模式 | |
document.body.clientHeight // 低版本混杂模式 | |
// 浏览器窗口顶部与文档顶部之间的距离,也就是滚动条滚动的距离 | |
window.pagYOffset // 标准浏览器及IE9+ | |
document.documentElement.scrollTop // 兼容ie低版本的标准模式 | |
document.body.scrollTop // 兼容混杂模式 |