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 execute = () => { | |
jQuery(($) => { | |
/// | |
// Do something | |
/// | |
}); | |
}; | |
const executeIf = (globalProp, execute) => () => { |
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
function setSticky(elementId) { | |
const stickyElement = document.getElementById(elementId) | |
const stickyTop = stickyElement.offsetTop | |
const setStickyClass = () => { | |
if (window.pageYOffset > stickyTop) { | |
stickyElement.classList.add('sticky') | |
} | |
else { | |
stickyElement.classList.remove('sticky') |
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 detectJQuery = () => typeof jQuery !== 'undefined' | |
doIf(detectJQuery, main, 1000) | |
function main() { | |
jQuery(($) => { | |
// jQuery detected | |
}) | |
} |
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
function doIf(predicate, callback, timeOut) { | |
setTimeout(() => { | |
if (predicate()) { | |
callback() | |
} | |
else { | |
doIf(predicate, callback); | |
} | |
}, timeOut) | |
} |
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
/**/ | |
/* Min Width */ | |
/**/ | |
@media (min-width: 0) { | |
} | |
@media (min-width: 576px) { |
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
@mixin when-xs { | |
@media all and (max-width: 575px) { | |
@content | |
} | |
} | |
@mixin when-sm { | |
@media all and (min-width: 576px) and (max-width: 767px) { | |
@content | |
} |
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
function allMatches (regex, text) { | |
if (!regex.global) throw new Error('option global not set') | |
let matches = [] | |
while(true) { | |
const match = regex.exec(text) | |
if (!match) break; | |
matches.push(match) | |
} |
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
new TextEncoder('utf-8').encode('\u0001') | |
new TextEncoder('utf-8').encode('\uffff') |
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
0x03De52113EA16E78b807905EF76D2323598E61c5 |
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
/* Modified from: https://css-tricks.com/dont-overthink-it-grids/ */ | |
.row { | |
margin: 0 -20px; | |
} | |
.row:after { | |
content: ""; | |
display: table; | |
clear: both; |
NewerOlder