Skip to content

Instantly share code, notes, and snippets.

View gillkyle's full-sized avatar
🐛
releasing more bugs into the wild

Kyle Gill gillkyle

🐛
releasing more bugs into the wild
View GitHub Profile
/* initially hide all banners except the first one */
.notice-banner {
display: none;
}
/* show the first banner that is not dismissed */
.notice-banner:not([data-dismissed='true']):first-of-type {
display: flex;
}
@gillkyle
gillkyle / google-taxonomy.json
Created June 28, 2023 17:18
Google's Product taxonomy used in classifying products for sale as a JSON file instead of a .txt file.
{
"id": "root",
"children": [
{
"id": "Animals & Pet Supplies",
"children": [
{ "id": "Live Animals", "children": [] },
{
"id": "Pet Supplies",
"children": [
function normalizeColor(hexCode) {
return [
((hexCode >> 16) & 255) / 255,
((hexCode >> 8) & 255) / 255,
(255 & hexCode) / 255
];
}
["SCREEN", "LINEAR_LIGHT"].reduce(
(hexCode, t, n) => Object.assign(hexCode, { [t]: n }),
{}
function normalizeColor(e){return[(e>>16&255)/255,(e>>8&255)/255,(255&e)/255]}["SCREEN","LINEAR_LIGHT"].reduce(((e,t,n)=>Object.assign(e,{[t]:n})),{});class MiniGl{constructor(e,t,n,i=!1){const s=this,o=-1!==document.location.search.toLowerCase().indexOf("debug=webgl");s.canvas=e,s.gl=s.canvas.getContext("webgl",{antialias:!0}),s.meshes=[];const r=s.gl;t&&n&&this.setSize(t,n),s.lastDebugMsg,s.debug=i&&o?function(e){const t=new Date;t-s.lastDebugMsg>1e3&&console.log("---"),console.log(t.toLocaleTimeString()+Array(Math.max(0,32-e.length)).join(" ")+e+": ",...Array.from(arguments).slice(1)),s.lastDebugMsg=t}:()=>{},Object.defineProperties(s,{Material:{enumerable:!1,value:class{constructor(e,t,n={}){function i(e,t){const n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),r.getShaderParameter(n,r.COMPILE_STATUS)||console.error(r.getShaderInfoLog(n)),s.debug("Material.compileShaderSource",{source:t}),n}function o(e,t){return Object.entries(e).map((([e,n])=>n.getDeclaration(e,t))).join("\n")}this.unif
@gillkyle
gillkyle / voltorbflip.com
Created December 29, 2021 20:13
Helpers for entering stuff into voltorbflip.com
// copy paste this into the console of Voltorbflip.com to make it easier to input numbers
function findAndFocus(id) {
document.getElementById(id).focus();
}
function clearInputs() {
document.querySelectorAll("input").forEach(input => {
input.value = ""
})
}
function handleChange(e) {
@gillkyle
gillkyle / chakra-skeleton-loader.jsx
Created July 31, 2021 22:33
Pass a status prop, if loading, render the skeleton, when loaded, the children.
import * as React from 'react'
import { Skeleton } from '@chakra-ui/react'
export default function SkeletonLoader({ skeletonProps, status, children }) {
if (status === 'loading')
return <Skeleton height="100%" width="100%" {...skeletonProps} />
if (status === 'error') return null
return children
}
add_action('graphql_register_types', function() {
register_graphql_mutation('submitShowcaseSiteFromPublicUser', [
'description' => __('Allow unauthenticated users to submit sites to the showcase, with limited fields.'),
'inputFields' => [
'title' => [
'type' => ['non_null' => 'String'],
],
'mainUrl' => [
'type' => ['non_null' => 'String'],
],
#!/usr/bin/env python3
# NOTE: this is a really naive solution that just checks for alt="" in the returned html from the page,
# it would probably give a lot of erroneous results on other projects but got the job done for me.
import urllib.request as urllib2
base_path = "https://gatsbyjs.com"
blog_paths = 'blog_paths.txt'
{
"workbench.editor.enablePreviewFromQuickOpen": false,
"workbench.colorTheme": "Hyper Term Black",
"workbench.iconTheme": "vscode-icons",
"workbench.sideBar.location": "right",
"workbench.colorCustomizations": {
"editor.selectionHighlightBackground": "#24386e",
"editor.findMatchBackground": "#2d364e",
"editor.findMatchHighlightBackground": "#38415c"
}

Add Authentication with Auth0 to a Gatsby site

All the pieces of authentication are possible in Gatsby. Thanks to Auth0, setting it up doesn't have to be so cumbersome!

This setup comes straight from Auth0's official quick start for React.


The first step is installing the official Auth0 SDK for JavaScript from npm.