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 getImageBrightness(imageSrc, callback) { | |
var img = document.createElement('img'), | |
colorSum = 0, | |
i = 0, | |
len, | |
canvas, | |
ctx, | |
imageData, | |
data, | |
brightness, |
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
Generate new SSH keys | |
ssh-keygen -t rsa -b 4096 -C "personal@mail.com" -f ~/.ssh/id_rsa_gitlab | |
ssh-keygen -t rsa -b 4096 -C "personal@mail.com" -f ~/.ssh/id_rsa_github | |
add config ~/.ssh/config | |
Host github.com | |
HostName github.com | |
User git | |
IdentityFile ~/.ssh/id_rsa_github | |
# Personal gitlab account |
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
const validateEmail = (email) => { | |
const re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ | |
return re.test(email) | |
} |
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
find . -name "node_modules" -exec rm -rf '{}' + |
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
const easings = { | |
linear (t, b, c, d) { | |
return c * t / d + b; | |
}, | |
easeInQuad (t, b, c, d) { | |
return c * (t /= d) * t + b; | |
}, | |
easeOutQuad (t, b, c, d) { | |
return -c * (t /= d) * (t - 2) + b; | |
}, |
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
const getRandomNumber = (min, max) => { | |
return Math.round(min - 0.5 + Math.random() * (max - min + 1)); | |
}; |
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 debounce (func, wait, immediate) { | |
let timeout | |
return function () { | |
const context = this | |
const args = arguments | |
const later = function () { | |
timeout = null | |
if (!immediate) { | |
func.apply(context, args) |
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
git rm --cached src/*.html |
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
// Открытие элемента в полноэкранный режим | |
const launchFullScreen = (el) => { | |
if (el.requestFullscreen) { | |
el.requestFullscreen() | |
} else if (el.webkitRequestFullScreen) { | |
el.webkitRequestFullScreen() | |
} else if (el.mozRequestFullScreen) { | |
el.mozRequestFullScreen() | |
} else if (el.msRequestFullscreen) { | |
el.msRequestFullscreen() |
NewerOlder