Skip to content

Instantly share code, notes, and snippets.

View m-allanson's full-sized avatar
💭
I may be slow to respond.

Mike Allanson m-allanson

💭
I may be slow to respond.
View GitHub Profile
class Queue {
constructor(private items: number[] = []) {}
async count() {
return this.items.length;
}
async pop() {
return this.items.shift();
}
async push() {
@m-allanson
m-allanson / configurationUpdate.js
Last active April 13, 2022 12:35 — forked from mvisintin/configurationUpdate.js
Minimal configuration update example
// Note you must be authorised to use the provided GCloud project.
// Use `gcloud auth application-default login` to auth for the current machine
const iot = require('@google-cloud/iot');
const { KeyManagementServiceClient } = require('@google-cloud/kms');
const uuid = require('uuid');
const { readFileSync } = require('fs');
const crypto = require('crypto');
const { config } = require('process');
const https = require("https");
const util = require("util");
// Adapted from https://gist.github.com/krnlde/797e5e0a6f12cc9bd563123756fc101f
https.get[util.promisify.custom] = function getAsync(options) {
return new Promise((resolve, reject) => {
https
.get(options, (response) => {
response.end = new Promise((resolve) => response.on("end", resolve));
resolve(response);
@m-allanson
m-allanson / showcase-and-starter-updates.md
Created November 19, 2019 14:18
Updates to starters and showcase between 19 Nov and 20 Sept 2019

Showcase

git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)' --follow -- docs/showcase.yml

* af053c3e0 - (3 days ago) chore(showcase): Add nmimicro.no to showcase. (#19565) - laradevitt
* f071e386e - (4 days ago) chore(showcase): Added bakkenbaeck.com (#19517) - Ezekiel Aquino
* 724f92226 - (4 days ago) chore(showcase): Add Figma Config to site showcase (#19524) - Corey Ward
* f54387854 - (5 days ago) Update sites.yml (#19469) - francismarcus
* 4fac1a3a5 - (6 days ago) Update sites.yml (#19475) - Emmanuel Vuigner

GraphQL works by using a "schema" to describe what data is available for querying.

A schema consists of a list of fields, and the "type" for each field. Each field must have a type. A type can be something like String or Int. (More complex custom types can be created too).

In Gatsby, "schema inference" is an automatic process where Gatsby examines your data, then works out the correct schema based on the data.

Here's some example data.

const myTitles = [
@m-allanson
m-allanson / gatsby-dependencies.md
Last active September 12, 2019 09:19
Direct dependencies of gatsby, gatsby-cli and gatsby-dev-cli

Notable entries

Notable entries from the full list, that have an existing Open Collective.

babel
browserslist
chalk - opencollective account is "sindresorhus"
core-js
eslint
@asciidoctor/core
@babel/cli
@cnakazawa/watch
@contentful/axios
@emotion/babel-plugin-jsx-pragmatic
@evocateur/libnpmaccess
@gustavnikolaj/async-main-wrap
@hapi/address
@jest/console
@jimp/bmp
@m-allanson
m-allanson / gatsby-node.js
Last active May 31, 2019 03:53
Modify a rule from your Gatsby site's webpack config
exports.onCreateWebpackConfig = ({ actions, getConfig }) => {
// inline files that are smaller than this (in bytes), Gatsby's default vaule is 10000
const LIMIT = 2000;
// find patterns from gatsby/src/utils/webpack-utils.js
// https://github.com/gatsbyjs/gatsby/blob/03ddfdf9b6f5a132fe82c202c95829f6f42cd40b/packages/gatsby/src/utils/webpack-utils.js#L288-L435
// for fonts instead of images, use: /\.(eot|otf|ttf|woff(2)?)(\?.*)?$/
const PATTERN = /\.(ico|svg|jpg|jpeg|png|gif|webp)(\?.*)?$/;
const config = getConfig();
@m-allanson
m-allanson / SketchSystems.spec
Last active May 14, 2019 08:22
Pull Requests
Pull Requests
Awaiting Maintainer Response
maintainer approves -> Approved
maintainer requests changes -> Awaiting Contributor Response
maintainer rejects -> Closed
maintainer finishes PR -> Approved
Awaiting Contributor Response
contributor updates -> Awaiting Maintainer Response
no timely contributor update -> Awaiting Maintainer Response
Approved
/**
* Creates a preload link pointing to myFonts' licence counting url. This
* allows hits to the site to register as font requests with myFonts, but
* ensures that we are not blocking CSS rendering by waiting for this request
* to complete.
*
* This avoids having to include the following in a CSS file:
* @import url("//hello.myfonts.net/count/<id>");
*
* Refs: