- remove unused remote branches to local
git fetch origin --prune
- remove unused remote tags to local
git fetch --prune --prune-tags origin
set -g @plugin 'catppuccin/tmux#v2.1.1' | |
set -g @catppuccin_flavor 'mocha' | |
set -g @plugin 'tmux-plugins/tmux-online-status' | |
set -g @plugin 'tmux-plugins/tmux-battery' | |
set -g @plugin 'tmux-plugins/tmux-cpu' | |
# Configure Catppuccin | |
set -g @catppuccin_status_background "none" |
"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]+$/ | |