Skip to content

Instantly share code, notes, and snippets.

import React, { useState, useEffect, useContext } from "react";
import { Checkout } from "shopify-storefront-api-typings";
import Client from "shopify-buy";
const SHOPIFY_CHECKOUT_STORAGE_KEY = "shopify_checkout_id";
const storefrontAccessToken = process.env.GASTBY_SHOPIFY_ACCESS_TOKEN as string;
const client = Client.buildClient({
storefrontAccessToken,
const sanityClient = require('@sanity/client');
const {
SANITY_API_TOKEN,
SANITY_PROJECT_ID,
SANITY_DATASET,
} = process.env;
const client = sanityClient({
projectId: SANITY_PROJECT_ID,
@matijagrcic
matijagrcic / PiHole.md
Created August 7, 2019 09:23
Raspberry Pi with PiHole
import PropTypes from 'prop-types';
type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
type Defined<T> = T extends undefined ? never : T;
/**
* Get the type that represents the props with the defaultProps included.
*
* Alternatively, we could have done something like this:
@matijagrcic
matijagrcic / HeaderLogo.tsx
Created May 22, 2019 07:46 — forked from ryanditjia/HeaderLogo.tsx
Gatsby + TypeScript
// Example useStaticQuery
// this is src/components/HeaderLogo.tsx
import { graphql, Link, useStaticQuery } from 'gatsby'
import React from 'react'
import { HeaderLogoQuery } from '../types/__generated__/HeaderLogoQuery'
const query = graphql`
query HeaderLogoQuery {
contentfulCompanyMetadata {
@matijagrcic
matijagrcic / NVMe_AHCI
Last active May 1, 2019 20:25
I've needed to change to ACHI so that the NVMe driver can be installed, it wouldn't otherwise and the Samsung Magician wouldn't recognize the drive. https://twitter.com/matijagrcic/status/1067498617366294528
If you don’t see Command Prompt listed, it’s because you have already been updated to a later version of Windows.
If so, use this method instead to get to the Command Prompt:
Click the Start Button and type cmd
Right-click the result and select Run as administrator
Type this command and press ENTER: bcdedit /set {current} safeboot minimal
If this command does not work for you, try bcdedit /set safeboot minimal
Restart the computer and enter BIOS Setup (the key to press varies between systems).
Change the SATA Operation mode to AHCI from either IDE or RAID (again, the language varies).
Save changes and exit Setup and Windows will automatically boot to Safe Mode.
Right-click the Windows Start Menu once more. Choose Command Prompt (Admin).
@matijagrcic
matijagrcic / NVMe_AHCI
Created May 1, 2019 20:25
I've needed to change to ACHI so that the NVMe driver can be installed, it wouldn't otherwise and the Samsung Magician wouldn't recognize the drive.
If you don’t see Command Prompt listed, it’s because you have already been updated to a later version of Windows.
If so, use this method instead to get to the Command Prompt:
Click the Start Button and type cmd
Right-click the result and select Run as administrator
Type this command and press ENTER: bcdedit /set {current} safeboot minimal
If this command does not work for you, try bcdedit /set safeboot minimal
Restart the computer and enter BIOS Setup (the key to press varies between systems).
Change the SATA Operation mode to AHCI from either IDE or RAID (again, the language varies).
Save changes and exit Setup and Windows will automatically boot to Safe Mode.
Right-click the Windows Start Menu once more. Choose Command Prompt (Admin).
Microsoft Windows [Version 10.0.17134.345]
(c) 2018 Microsoft Corporation. All rights reserved.
C:\Windows\system32>cd %systemroot%\system32
C:\Windows\system32>copy mstsc.exe mstsc2.exe
1 file(s) copied.
C:\Windows\system32>cd %systemroot%\system32\en-us\
@matijagrcic
matijagrcic / VSCode_AspNETCore.txt
Last active January 13, 2019 23:03
dotnet new - Creates a new project, configuration file, or solution based on the specified template.
> dotnet dev-certs https --trust
> https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-new?tabs=netcore21
> dotnet run
Templates Short Name Language Tags
----------------------------------------------------------------------------------------------------------------------------
Console Application console [C#], F#, VB Common/Console
Class library classlib [C#], F#, VB Common/Library
Unit Test Project mstest [C#], F#, VB Test/MSTest
NUnit 3 Test Project nunit [C#], F#, VB Test/NUnit