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
// bug regex uses on chrome | |
// bug | |
const regex = /./g; | |
console.log(regex.test('a')) // true | |
console.log(regex.test('a')) // false | |
// no bug | |
const regex = /./g; | |
console.log(cloneRegex(regex).test('a')) // true |
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
// getScrolls.js v1 | |
const getScrolls = { | |
element: window, | |
x: 'scrollX', | |
y: 'scrollY' | |
}; | |
if (!('scrollX' in window && 'scrollY' in window)) { | |
if ('pageXOffset' in window && 'pageYOffset' in window) { | |
getScrolls.x = 'pageXOffset'; | |
getScrolls.y = 'pageYOffset'; |
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
/* flex-center.css v1 */ | |
.flex-center { | |
align-items: center; | |
display: flex; | |
justify-content: center; | |
} |
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
/* bs4-media.css v1 */ | |
text-align: center; | |
@media all and(min-width:576px){ | |
text-align: center; | |
} | |
@media all and(min-width:768px){ | |
text-align: center; | |
} | |
@media all and(min-width:992px){ | |
text-align: center; |
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
// setTimesout.js v2.1 | |
function setTimesout(function_, repeats = [0]) { | |
if (typeof(function_) !== "function") { | |
throw new Error("The first argument must be of type 'function'") | |
} | |
if (!Array.isArray(repeats)) { | |
throw new Error("The second argument must be of type 'object' (array)") | |
} | |
repeats = repeats.sort((a, b) => { | |
return a - 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
/* mixin-bs4-width-classes.scss v1.0.1 */ | |
$widths: | |
1 | |
2 | |
3 | |
; | |
$bs4GridExtended: | |
576px | |
768px |
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
// getScrollbarSize.js v1 | |
const cssText = '#scrollbar-size{height:99px;overflow:scroll;position:absolute;top:-9999px;width:99px}', | |
head = document.getElementsByTagName('head')[0] || document.body.parentNode.children[0], | |
style = document.createElement('style'), | |
scrollSizeDiv = document.createElement('div'), | |
scrollbarSize = undefined; | |
style.setAttribute('type', 'text/css'); | |
style.setAttribute('rel', 'stylesheet'); | |
if (!('styleSheet' in style)) { | |
style.appendChild(document.createTextNode(cssText)); |
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
/*! | |
* is.js 0.9.0 | |
* Author: Aras Atasaygin. Adapted by Luis Lobo | |
*/ | |
// define 'is' object and current version | |
let is = {}; | |
is.VERSION = '0.9.0'; | |
// store navigator properties to use later |
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
// capitalize.js v1 | |
function capitalize(text){ | |
return text.replace(/\w/g, function(match){ | |
return match.toUpperCase(); | |
}); | |
}; |
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
// px-to-mm.js v1 | |
function pxToMm(px){ | |
return px * 0.2645833333; | |
}; |
NewerOlder