Skip to content

Instantly share code, notes, and snippets.

View Drew-Killeen's full-sized avatar

Drew Killeen Drew-Killeen

  • 19:32 (UTC -04:00)
View GitHub Profile
const observer = new IntersectionObserver((entries) => {
entries.forEach((entry) => {
if (entry.isIntersecting) {
entry.target.classList.add('show');
}
});
});
const hiddenElements = document.querySelectorAll('.hide-animate');
hiddenElements.forEach((element) => {
observer.observe(element);
@Drew-Killeen
Drew-Killeen / debounce.ts
Last active January 15, 2024 15:35
TypeScript debounce function
function debounce (callback: Function, duration: number, timer: number) {
if (timer) {
clearTimeout(timer);
}
timer = setTimeout(callback, duration);
};
@Drew-Killeen
Drew-Killeen / throttle.ts
Created January 13, 2024 21:11
TypeScript Throttle Function
function throttle(callback: Function, time: number, throttlePause: boolean) {
if (throttlePause) {
return;
}
throttlePause = true;
setTimeout(() => {
callback();
throttlePause = false;
}, time);
@Drew-Killeen
Drew-Killeen / SassMeister-input.scss
Created April 10, 2014 13:25
Generated by SassMeister.com.
// ----
// Sass (v3.3.5)
// Compass (v1.0.0.alpha.18)
// ----
@import url(http://fonts.googleapis.com/css?family=Candal);
@import url('https://raw.githubusercontent.com/Drew-Killeen/GigabyteStudios/master/misc.css');
@import url('https://raw.githubusercontent.com/Drew-Killeen/GigabyteStudios/master/mobile.css');
/*