Skip to content

Instantly share code, notes, and snippets.

View abohannon's full-sized avatar

Adam Bohannon abohannon

View GitHub Profile
@raphael-leger
raphael-leger / lazyWithRetry.js
Last active April 17, 2024 17:51
React LazyWithRetry
import { lazy } from 'react';
const lazyWithRetry = (componentImport) =>
lazy(async () => {
const pageHasAlreadyBeenForceRefreshed = JSON.parse(
window.localStorage.getItem(
'page-has-been-force-refreshed'
) || 'false'
);
@swyxio
swyxio / Gatsby-bootstrap-lifecycle.md
Last active April 1, 2022 11:19
Gatsby bootstrap lifecycle

Sequence of Gatsby's bootstrap lifecycle with links to source code as of v2.0.0

  1. open and validate gatsby-config (get-config-file.js) 1.5 load themes (swyx added this note July 2019)
  2. load plugins (load-plugins/index.js) from the list given in gatsby-config.js
  3. onPreBootstrap: runs onPreBootstrap if it is implemented in any plugins, for example gatsby-plugin-typography. Receives handy [apiCallArgs](https://github.com/gatsbyjs/gatsby/blob/ffd8b2d691c9
@wojteklu
wojteklu / clean_code.md
Last active April 25, 2024 12:09
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@PurpleBooth
PurpleBooth / README-Template.md
Last active April 22, 2024 11:45
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@carolineschnapp
carolineschnapp / page.list-collections.liquid
Last active June 21, 2021 20:39
To add at the bottom of page.list-collections.liquid. In the New Standard theme, use the content of page.full-width.liquid and copy the code at the bottom of that content. This won't work in the Lookbook, Brooklyn, Simple and Kickstand themes.
{% comment %}
Collections are listed here.
{% endcomment %}
{% capture uses_minimal_framework %}{% include 'product-loop' %}{% endcapture %}
{% if uses_minimal_framework contains 'Liquid error' %}
{% assign uses_minimal_framework = false %}
{% assign grid_item_width = 'large--one-quarter medium--one-third small--one-half large--col-3 medium--col-4 small--col-6' %}
{% else %}
@ingdir
ingdir / gist:0b211b9253c376f9cfa5
Last active December 3, 2023 11:47
BEM Cheatsheet

BEM Cheatsheet

BLOCK

Block encapsulates a standalone entity that is meaningful on its own.

While blocks can be nested and interact with each other, semantically they remain equal; there is no precedence or hierarchy.

Holistic entities without DOM representation (such as controllers or models) can be blocks as well.