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 getAllCombinations = (arraysToCombine) => { | |
const divisors = []; | |
let combinationsCount = 1; | |
for (let i = arraysToCombine.length - 1; i >= 0; i--) { | |
divisors[i] = divisors[i + 1] ? divisors[i + 1] * arraysToCombine[i + 1].length : 1; | |
combinationsCount *= (arraysToCombine[i].length || 1); | |
} | |
const getCombination = (n, arrays, divisors) => arrays.reduce((acc, arr, i) => { | |
acc.push(arr[Math.floor(n / divisors[i]) % arr.length]); |
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 baseUrl = window.location.origin; | |
const absoluteUrlRegex = new RegExp('^(?:[a-z]+:)?//', 'i'); | |
const isAbsoluteUrl = (url) => absoluteUrlRegex.test(url); | |
const isLocalUrl = (url) => url.startsWith(baseUrl) || !isAbsoluteUrl(url); | |
// https://gist.github.com/ -> github.com | |
const getDomain = (url) => { | |
const urlInstance = new URL(url); | |
const dividedUrl = urlInstance.hostname.split('.'); |
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
// https://stackoverflow.com/a/36310163/12496886 | |
export const transliterateRuToEN = (text) => text | |
.replace(/\u0401/g, 'YO') | |
.replace(/\u0419/g, 'I') | |
.replace(/\u0426/g, 'TS') | |
.replace(/\u0423/g, 'U') | |
.replace(/\u041A/g, 'K') | |
.replace(/\u0415/g, 'E') | |
.replace(/\u041D/g, 'N') |
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
/*** | |
inspired by https://stackoverflow.com/a/36310163/12496886 | |
transliterateGeToEN('აბგდევზთიკლმნოპჟრსტღყშცჩძწჭხჯჰ') // "abgdevztiklmnopzhrstghkhshcchdztschxjh" | |
***/ | |
export const transliterateGeToEN = (text) => text | |
.replace(/\u10D0/g, 'a') | |
.replace(/\u10D1/g, 'b') | |
.replace(/\u10D2/g, 'g') | |
.replace(/\u10D3/g, 'd') |
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
ul { | |
list-style: none; | |
li { | |
&:before { | |
content: "•"; | |
color: red; | |
font-weight: 700; | |
display: inline-block; | |
width: 1em; |
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
// https://stackoverflow.com/questions/48470407/client-side-convert-png-file-stream-into-file-object | |
// Example src http://localhost:1337/uploads/bbf9e6e15a3841fba491dfd3972da6a4.jpg | |
// @returns bbf9e6e15a3841fba491dfd3972da6a4 | |
const getImgName = (url) => url.slice(url.lastIndexOf('/') + 1, url.indexOf('.')); | |
const srcToFile = async (src, fileName = getImgName(src)){ | |
const response = await axios.get(src, { | |
responseType: 'blob' | |
}); |
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
# ---------------------- | |
# Git Aliases | |
# ---------------------- | |
alias g='git' | |
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then | |
. /etc/bash_completion | |
fi | |
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
git checkout stash@{index} -- <filename> <filename> ... |
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
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"type": "chrome", | |
"request": "launch", | |
"name": "vue: chrome", | |
"url": "http://localhost:8080", | |
"webRoot": "${workspaceFolder}/*", | |
"breakOnLoad": 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
open() { | |
const offset = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop; | |
document.body.style.top = (offset * -1) + 'px'; | |
document.body.classList.add('iOS-scroll-fix'); | |
} | |
close() { | |
const offset = parseInt(document.body.style.top, 10); | |
document.body.classList.remove('iOS-scroll-fix'); | |
document.body.style.top = 0; |
NewerOlder