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 validURL(str) { | |
var pattern = new RegExp( | |
'^(https?:\\/\\/)?' + // protocol | |
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // domain name | |
'((\\d{1,3}\\.){3}\\d{1,3}))' + // OR ip (v4) address | |
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // port and path | |
'(\\?[;&a-z\\d%_.~+=-]*)?' + // query string | |
'(\\#[-a-z\\d_]*)?$', | |
'i', | |
); // fragment locator |
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
export function abbreviatedNumber(value: number): string { | |
if (isNaN(value)) { | |
return ""; | |
} | |
let newValue = value; | |
const suffixes = ["", "K", "M", "B", "T"]; | |
let suffixNum = 0; | |
while (newValue >= 1000) { | |
newValue /= 1000; | |
suffixNum++; |
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
set nocompatible " be iMproved, required | |
filetype off " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" alternatively, pass a path where Vundle should install plugins | |
"call vundle#begin('~/some/path/here') | |
" let Vundle manage Vundle, required |
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 clipBoardWriteValue(value, ref) { | |
// If we have the navigator.clipboard then it is possible to write a string to a clipboard directly | |
if (navigator.clipboard) { | |
navigator.clipboard.writeText(value) | |
.then(() => { | |
this.showCopiedBadge(); | |
}); | |
return; | |
} | |
// Otherwise, we need to select some node's content and run document.execCommand('copy') |