This file contains hidden or 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
| // ==UserScript== | |
| // @name Get of extension from Chrome-WebStore [chrome.google.com] | |
| // @version 0.4 | |
| // @description Add button for get .crx of extension or theme from Chrome-WebStore | |
| // @description Bookmarklet version: http://bit.ly/get_crx_chrome_bookmarklet | |
| // @author Vyacheslav Vasiliev | |
| // @history 2022.09 Fix problem with bookmarklet in Chrome-like browsers. Add accept formats. | |
| // @history 0.3 Fix problem with bookmarklet in Chrome-like browsers. Add independent style for the button download. | |
| // @history 0.2 Add new method download | |
| // @include *chrome.google.com/webstore/* |
This file contains hidden or 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 dedupe(strToDedupe, caseSensitive=false){ | |
| let rpl = (caseSensitive) ? /^(.*)(\r?\n\1)+$/gm : /^(.*)(\r?\n\1)+$/gim | |
| return(strToDedupe.replace(rpl, "")); | |
| } |
This file contains hidden or 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
| /** | |
| * @description: Blob|File 转DataUrl | |
| * @param {Blob|File} file 文件 | |
| * @return {String} | |
| */ | |
| export function fileToDataUrl(file) { | |
| return new Promise((resolve, reject) => { | |
| try { | |
| const reader = new FileReader(); | |
| reader.readAsDataURL(file); |
This file contains hidden or 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 regexLib = { | |
| multiLineCComments: a("/\\*.*?\\*/", "gs"), | |
| singleLineCComments: /\/\/.*$/gm, | |
| singleLinePerlComments: /#.*$/gm, | |
| doubleQuotedString: /"([^\\"\n]|\\.)*"/g, | |
| singleQuotedString: /'([^\\'\n]|\\.)*'/g, | |
| multiLineDoubleQuotedString: a('"([^\\\\"]|\\\\.)*"', "gs"), | |
| multiLineSingleQuotedString: a("'([^\\\\']|\\\\.)*'", "gs"), | |
| xmlComments: a("(<|<)!--f.*?--(>|>)", "gs"), | |
| url: /\w+:\/\/[\w-.\/?%&=:@;#]*/g, |
This file contains hidden or 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 string = "Image is in png format"; | |
| const myRegex = /(png|gif|jpg|jpeg)/; // '|' is a or operator | |
| const result = myRegex.test(string); | |
| console.log(result); // returns true |
This file contains hidden or 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
| // ==UserScript== | |
| // @name Streamyard Keyboard Shortcuts | |
| // @namespace http://streamyard.com | |
| // @version 1.0 | |
| // @description Keyboard shortcuts for streamyard | |
| // @author Lior Kamrat | |
| // @match https://streamyard.com/* | |
| // @grant none | |
| // @run-at document-end | |
| // ==/UserScript== |
This file contains hidden or 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
| Write-Information "This script needs be run on Windows Server 2019 or 2022" | |
| If ($PSVersionTable.PSVersion.Major -ge 7){ Write-Error "This script needs be run by version of PowerShell prior to 7.0" } | |
| # Define environment variables | |
| $downloadDir = "C:\WinGet" | |
| $gitRepo = "microsoft/winget-cli" | |
| $msiFilenamePattern = "*.msixbundle" | |
| $licenseFilenamePattern = "*.xml" | |
| $releasesUri = "https://api.github.com/repos/$gitRepo/releases/latest" |
This file contains hidden or 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
| /** | |
| * ☃ dateDiff "Snowman Carl" (http://stackoverflow.com/questions/13903897) | |
| * Returns a detail object about the difference between two dates | |
| * | |
| * When providing custom units, provide them in descending order (eg week,day,hour; not hour,day,week) | |
| * | |
| * @param {Date} dateStart - date to compare to | |
| * @param {Date|string} [dateEnd=new Date()] - second date, can be used as unit param instead | |
| * @param {...string} [units=Object.keys(dateDiffDef)] - limits the returned object to provided keys | |
| */ |
This file contains hidden or 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 convertToMinutes = (time) => { | |
| let [hr,minute] = time.split(":"); | |
| if( Number.parseInt(hr) > 23 || Number.parseInt(minute) > 59) return 0; | |
| return ( Number.parseInt(hr)*60)+ Number.parseInt(minute); | |
| } | |
| const minimumTimeDifference = ( times ) =>{ |
This file contains hidden or 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
| # NPM CheatSheet. | |
| # Super easy intall: npm comes with node now. | |
| # To create your own npm package: https://www.npmjs.org/doc/misc/npm-developers.html | |
| # More: https://www.npmjs.org/doc/ | |
| # 1. NPM Command Lines. | |
| # Local mode is the default. | |
| # Use --global or -g on any command to operate in global mode instead. |