Skip to content

Instantly share code, notes, and snippets.

View nathansh's full-sized avatar
🏠

Nathan Shubert-Harbison nathansh

🏠
View GitHub Profile
{
"bootstrapped": true,
"in_process_packages":
[
],
"installed_packages":
[
"AutoWrap",
"Color Highlighter",
"EditorConfig",
@nathansh
nathansh / tile.svg
Created June 9, 2015 17:42
Allow for background svg tile in IE
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nathansh
nathansh / readme.md
Last active June 20, 2016 19:13
JavaScript module for a generic toggler

JavaScript module for a generic toggler. Main element is '.js-toggler, clicking child element .js-toggler__header adds and .is-open class to open the content (control this with CSS). Escape key and outside clicks close the most recently opened item.

@nathansh
nathansh / useMediaQuery.js
Last active September 11, 2019 23:41
React Hook Media Query
// const small = useMediaQuery('900px');
// return ( <h3>{small ? 'Small' : 'Large'}</h3> );
const useMediaQuery = (size, bound = 'max') => {
const query = `(${bound}-width: ${size})`;
const [matches, setMatches] = useState(window.matchMedia(query).matches);
useEffect(() => {
const mediaQuery = window.matchMedia(query);