Skip to content

Instantly share code, notes, and snippets.

@luislobo14rap
luislobo14rap / getScrolls.js
Created October 10, 2022 00:30
getScrolls.js
// 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';
@luislobo14rap
luislobo14rap / flex-center.css
Last active May 6, 2023 03:17
flex-container.css
/* flex-center.css v1 */
.flex-center {
align-items: center;
display: flex;
justify-content: center;
}
@luislobo14rap
luislobo14rap / bs4-media.css
Created October 10, 2022 00:30
bs4-snippets.txt
/* 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;
@luislobo14rap
luislobo14rap / setTimesout.js
Last active May 11, 2023 12:12
setTimesout.js
// setTimesout.js v2
function setTimesout(function_ = (time, index) => {}, repeats = [0]) {
repeats = repeats.sort((a, b) => {
return a - b
})
for (let i = 0; i < repeats.length; i++) {
setTimeout(() => {
function_(time = repeats[i], index = i)
}, repeats[i])
}
@luislobo14rap
luislobo14rap / mixin-bs4-width-classes.scss
Created October 10, 2022 00:30
mixin-bs4-width-classes.scss
/* mixin-bs4-width-classes.scss v1.0.1 */
$widths:
1
2
3
;
$bs4GridExtended:
576px
768px
@luislobo14rap
luislobo14rap / getScrollbarSize.js
Created October 10, 2022 00:30
getScrollbarSize.js
// 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));