Skip to content

Instantly share code, notes, and snippets.

@kevinmeyvaert
kevinmeyvaert / useScrollIntoView.tsx
Created January 15, 2019 11:33
Scroll node to center React Hook
const useScrollIntoView = (condition: boolean) => {
const ref = React.useRef<HTMLDivElement | null>(null);
React.useEffect(() => {
if (condition && ref.current) {
ref.current.scrollIntoView({
behavior: 'smooth',
block: 'center',
inline: 'center',
});
}
@kevinmeyvaert
kevinmeyvaert / index.php
Created March 8, 2018 07:13
Serving Craft 3 from webroot: how to setup your index.php entry file.
<?php
/**
* Craft web bootstrap file
*/
// Set path constants
define('CRAFT_BASE_PATH', dirname(__FILE__));
define('CRAFT_VENDOR_PATH', './vendor');
// Load Composer's autoloader