Skip to content

Instantly share code, notes, and snippets.

View JimOfLeisure's full-sized avatar
Having a leisurely day

Jim Nelson JimOfLeisure

Having a leisurely day
View GitHub Profile
@5t3ph
5t3ph / gatsby-useLocation-hook-change-theme.js
Last active November 28, 2022 13:16
In Gatsby, leverage Reach Router's useLocation hook along with the query-string package to change user's selected theme, or expand to any values you need from the URL parameters, available on `location.search` from the useLocation hook.
import * as React from 'react';
import { useLocation } from '@reach/router';
import queryString from 'query-string';
const getSelectedTheme = (query) => {
const fallback = 'light';
if (query) {
const queriedTheme = queryString.parse(query);
@nexxos
nexxos / ARIA Accessibility cheatsheet
Created October 2, 2013 09:05
Simple HTML5 boilerplate serving as WAI-ARIA / accessibility cheatsheet.
<!doctype html>
<html>
<head>
<title>Document title</title>
<meta charset='utf-8'>
<meta name='description' content='Description of document content'>
</head>
<body>