Skip to content

Instantly share code, notes, and snippets.

View boardev's full-sized avatar

Boar boardev

  • MHP
  • Ukraine
  • 04:12 (UTC +02:00)
View GitHub Profile
@boardev
boardev / get_crx_on_chrome_webstore.user.js
Created August 15, 2023 17:49 — forked from vyach-vasiliev/get_crx_on_chrome_webstore.user.js
Get of extension from Chrome-WebStore (User Script)
// ==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/*
@boardev
boardev / DeDupeLines.js
Created August 15, 2023 17:42 — forked from UInIQ/DeDupeLines.js
JS + REGEX: Remove duplicate lines
function dedupe(strToDedupe, caseSensitive=false){
let rpl = (caseSensitive) ? /^(.*)(\r?\n\1)+$/gm : /^(.*)(\r?\n\1)+$/gim
return(strToDedupe.replace(rpl, ""));
}
@boardev
boardev / file.js
Created August 14, 2023 04:15 — forked from xyalim/file.js
[file dataURL base64 ] #jsUtils #jsFile
/**
* @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);
@boardev
boardev / regex_list.js
Last active August 4, 2023 09:02 — forked from charrismatic/regex_list.js
Useful Regex String List
const regexLib = {
multiLineCComments: a("/\\*.*?\\*/", "gs"),
singleLineCComments: /\/\/.*$/gm,
singleLinePerlComments: /#.*$/gm,
doubleQuotedString: /"([^\\"\n]|\\.)*"/g,
singleQuotedString: /'([^\\'\n]|\\.)*'/g,
multiLineDoubleQuotedString: a('"([^\\\\"]|\\\\.)*"', "gs"),
multiLineSingleQuotedString: a("'([^\\\\']|\\\\.)*'", "gs"),
xmlComments: a("(&lt;|<)!--f.*?--(&gt;|>)", "gs"),
url: /\w+:\/\/[\w-.\/?%&=:@;#]*/g,
@boardev
boardev / OR_operator.js
Created August 3, 2023 12:29 — forked from imboss712/OR_operator.js
Regex_With_JavaScript_Intermediate_Level
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
// ==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==
@boardev
boardev / WinGet_WinSrv.ps1
Created August 2, 2023 03:16 — forked from likamrat/WinGet_WinSrv.ps1
Installing Winget om Windows Server 2019/2022
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"
@boardev
boardev / dateDiff.ts
Created July 26, 2023 09:57 — forked from RienNeVaPlus/dateDiff.ts
🕤 dateDiff() - returns a detail object about the difference between two dates
/**
* ☃ 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
*/
@boardev
boardev / MinimumTimeDifference.js
Created July 26, 2023 09:41 — forked from osahondev/MinimumTimeDifference.js
Time Management Implementation to help Esther manage her time effectively
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 ) =>{
# 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.