Skip to content

Instantly share code, notes, and snippets.

View DSchau's full-sized avatar

Dustin Schau DSchau

View GitHub Profile
@DSchau
DSchau / goodreads.csv
Created October 28, 2026 20:24
goodreads
We can make this file beautiful and searchable if this error is corrected: It looks like row 5 should actually have 23 columns, instead of 8 in line 4.
Book Id,Title,Author,Author l-f,Additional Authors,ISBN,ISBN13,My Rating,Publisher,Binding,Number of Pages,Year Published,Original Publication Year,Date Read,Date Added,Bookshelves,Bookshelves with positions,Exclusive Shelf,My Review,Spoiler,Private Notes,Read Count,Owned Copies
241434373,"The Infinity Machine: Demis Hassabis, DeepMind, and the Quest for Superintelligence",Sebastian Mallaby,"Mallaby, Sebastian",,"=""0593831845""","=""9780593831847""",0,Penguin Press,Hardcover,480,2026,,,2026/08/30,currently-reading,currently-reading (#3),currently-reading,,,,2,0
223420465,King Sorrow,Joe Hill,"Hill, Joe",,"=""0062200607""","=""9780062200600""",0,William Morrow,Hardcover,896,2025,2025,,2026/10/24,to-read,to-read (#216),to-read,,,,0,0
62919847,The Reformatory,Tananarive Due,"Due, Tananarive",,"=""1982188340""","=""9781982188344""",0,S&S/Saga Press,Hardcover,570,2023,2023,,2026/10/24,to-read,to-read (#215),to-read,,,,0,0
242811845,Our Cut of Salt,Deena Helm,"Helm, Deena",,"=""1250434661""","=""9781250434661""",
@DSchau
DSchau / optimize.sh
Created December 30, 2022 18:51
Optimize Images
#!/bin/bash
find . \( -name '*.JPG' -o -name '*.jpg' \) -size +10kb | while read f
do
filename="optimized/$(echo $f | sed "s/\.\///g")"
echo "$filename"
convert "$f" -sampling-factor 4:2:0 -strip -quality 85 -interlace JPEG "$filename"
done
@DSchau
DSchau / gatsbyjs.com
Created September 22, 2022 03:11
Meta Tags
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<style id="typography.js">
@DSchau
DSchau / gatsby-config-drupal.js
Last active September 18, 2022 22:04
Gatsby Configs
module.exports = {
siteMetadata: {
title: 'Drupal + Bayer Starter',
description: 'Official boilerplate for getting up and running with Drupal + Gatsby for the Bayer team'
},
plugins: [
{
resolve: 'gatsby-source-drupal',
options: {
baseUrl: 'https://path-to-drupal.com'
@DSchau
DSchau / README.md
Created April 9, 2022 20:51
Caching with a Plugin

Instructions

  1. Check out the caching repo
  2. Push to Gatsby Cloud
  3. First build will log "Cache not persisted, getting new characters"
  4. Subsequent builds will not
    • Can validate with a builds webhook invocation: curl -X POST https://webhook.gatsbyjs.com/hooks/data_source/publish/0f86ced9-2fa3-4738-80d8-23786226a8f3

Note: there are several conditions in which the cache is (automatically) cleared. They are documented in the cache API docs.

@DSchau
DSchau / rss-status.xml
Last active February 9, 2022 15:36
PSU 200 for rss.xml
<pingdom_http_custom_check>
<status>200</status>
<response_time>10000</response_time>
</pingdom_http_custom_check>
@DSchau
DSchau / cypress.json
Last active April 17, 2020 01:07
Cypress + Gatsby Recipe
{
"baseUrl": "http://localhost:8000"
}
@DSchau
DSchau / gatsby-cypress.mdx
Last active April 10, 2020 15:56
Gatsby + Cypress recipe

Gatsby and Cypress can be used together seamlessly (and should be!). [Cypress][cypress] enables you to run end-to-end tests on your client-side application, which is what Gatsby produces.

First, we'll want to install Cypress and additional dependencies.


@DSchau
DSchau / index.js
Created November 12, 2019 00:20
Plain ol' static images with Gatsby
import React from 'react'
import imgSrc from './assets/whatever.png'
export default () => (
<div>
<h1>Look below! A static image</h1>
<img src={imgSrc} /> {/* I'm a plain ol' static image */}
</div>
)
@DSchau
DSchau / resilient-fetch.js
Last active November 7, 2019 05:19
Semi Resilient Network Request
// make sure you wrap this in a useEffect, componentDidMount, etc.
const safeFetch = (timeout = 10000) => {
return (...args) => {
// this is sorta "unsafe" in the sense that a slow connection could cause this timeout
// a safer way would be to tap into and investigate error codes for e.g. ad blocked resources
// but this gets the idea across
return Promise.race([
fetch(...args),
new Promise((resolve, reject) => setTimeout(() => reject(new Error('Ad blocked or something')), timeout) // this failed, short-circuit
])