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
/remind #channel “Time to post your Daily Update | |
Y: What you do yesterday? | |
T: What are you working on today? | |
B: Do you have any blockers?” at 10AM every weekday. |
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
/** | |
* Check if Element is in View | |
*/ | |
function elementIsVisible(el, offset) { | |
const rect = el.getBoundingClientRect(); | |
return ( | |
rect.top < window.innerHeight && rect.bottom - offset >= 0 | |
); | |
} |
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 copyInputValueToClipboard(input) { | |
input.select(); | |
document.execCommand("copy"); | |
console.log(`${input.value} copied to clipboard!`) | |
} |
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 getAncestorByAttribute(elem, attribute) { | |
if (elem.parentElement === null) { | |
return false; | |
} else if (elem.hasAttribute(attribute)) { | |
return elem; | |
} else { | |
return getAncestorByAttribute(elem.parentElement, attribute); | |
} | |
} |
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
/** | |
* Unwrap element | |
*/ | |
function unwrap(wrapper) { | |
// place childNodes in document fragment | |
var docFrag = document.createDocumentFragment(); | |
while (wrapper.firstChild) { | |
var child = wrapper.removeChild(wrapper.firstChild); | |
docFrag.appendChild(child); | |
} |
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
/** | |
* Debounce Function | |
* to reduce # of events fired | |
* example: Scroll listeners | |
*/ | |
function debounce(callback, interval) { | |
let debounceTimeoutId; | |
return function(...args) { | |
clearTimeout(debounceTimeoutId); |
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 corsTest(url) { | |
console.log("cors-test"); | |
var http = new XMLHttpRequest(); | |
http.open('GET', url, true); | |
http.onreadystatechange = function() {//Call a function when the state changes. | |
console.log(http.responseText) | |
} |
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
/* Coursey of https://alligator.io/css/css-scrollbars */ | |
/* The emerging W3C standard | |
that is currently Firefox-only */ | |
* { | |
scrollbar-width: thin; | |
scrollbar-color: blue orange; | |
} | |
/* Works on Chrome/Edge/Safari */ |
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
/** | |
* Filter the except length to 20 words. | |
* | |
* @param int $length Excerpt length. | |
* @return int (Maybe) modified excerpt length. | |
*/ | |
function wpdocs_custom_excerpt_length( $length ) { | |
return 20; | |
} | |
add_filter( 'excerpt_length', 'wpdocs_custom_excerpt_length', 999 ); |
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
//Modal styles - mostly based on Bootstrap | |
@mixin modal() { | |
position: fixed; | |
pointer-events: none; | |
opacity: 0; | |
top: 0; | |
right: 0; | |
bottom: 0; | |
left: 0; | |
z-index: 1050; |
NewerOlder