Skip to content

Instantly share code, notes, and snippets.

View njbmartin's full-sized avatar
:octocat:
Focusing

Nicholas Martin njbmartin

:octocat:
Focusing
  • United Kingdom
  • 01:30 (UTC +01:00)
View GitHub Profile

Install the Shopify CLI and aliases

$SHELL -c "$(curl -fsSL https://gist.githubusercontent.com/njbmartin/af0445347a29ec00686713061d2d1138/raw/install-shopify-cli.sh)"

Install aliases

The script will detect if using bash or zsh and install accordingly

@njbmartin
njbmartin / .babelrc
Created November 16, 2021 16:27
Gatsby v4 + Storybook v6 + Theme UI (Emotion v11)
{
"presets": [
[
"babel-preset-gatsby",
{
"reactRuntime": "automatic"
}
]
]
}
import React from 'react'
import { useGoogleOptimize } from '@heights/react-use-google-optimize'
const App = () => {
const [isVariation] = useGoogleOptimize("OPTIMIZE_EXPERIMENT_ID")
return (
<>
<h1>{ isVariation ? "This is a variant" : "This is control" }</h1>
</>
interface Person {
firstName: string;
lastName: string;
email: string;
phone: string;
}
type PersonWithoutEmail = Omit<Person, "email">
type PersonWithoutEmailOrPhone = Omit<Person, "email" | "phone">
const person = {
firstName: "Jane",
lastName: "Bloggs",
email: "jane@example.com",
phone: "0123456789"
};
const omitKey = <T, K extends keyof T>(data: T, key: K) => {
const { [key]: _, ...o } = data;
return o;
interface Person {
firstName: string;
lastName: string;
email: string;
phone: string;
}
const person: Person = {
firstName: "Jane",
lastName: "Bloggs",
const person = {
firstName: "Jane",
lastName: "Bloggs",
email: "jane@example.com",
phone: "0123456789"
};
const omitKey = (data, key) => {
const { [key]: _, ...rest } = data
return rest
const person = {
firstName: "Jane",
lastName: "Bloggs",
email: "jane@example.com",
phone: "0123456789"
};
const {
email,
...personWithoutEmail
const person = {
firstName: "Jane",
lastName: "Bloggs",
email: "jane@example.com",
phone: "0123456789"
};
console.log(person.email);
// expected output: "jane@example.com"
delete person.email;
console.log(person.email);
import { v4 as uuidv4 } from "uuid"
import { DiggyDB, DiggyQuery } from "diggydb-nodejs"
const db = new DiggyDB({
hostname: "example.com",
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
})
interface Framework {