Skip to content

Instantly share code, notes, and snippets.

Avatar
⚛️

Isaac Martin isaac-martin

⚛️
View GitHub Profile
@isaac-martin
isaac-martin / TabsInput.tsx
Last active Aug 31, 2021
custom input component
View TabsInput.tsx
import * as React from "react";
import ObjectInput from "@sanity/form-builder/lib/inputs/ObjectInput";
import { TabList, TabPanel, Tab, Card } from "@sanity/ui";
import { Fieldset } from "@sanity/types/lib/schema/types";
import ValidationStatus from "@sanity/base/lib/__legacy/@sanity/components/validation/ValidationStatus";
import { FieldsetMarkersCollection } from "../MarkersCollection";
import styled from "@emotion/styled";
import { sanityTheme } from "../common/theme";
import { ObjectFormBuilder } from "../ObjectFormBuilder";
View ExperimentInputComponents.tsx
import * as React from "react";
import { useImmer } from "use-immer";
import Select from "part:@sanity/components/selects/default";
import Fieldset from "part:@sanity/components/fieldsets/default";
import PatchEvent, { setIfMissing, set } from "part:@sanity/form-builder/patch-event";
import { FormBuilderInput } from "part:@sanity/form-builder";
import { FIELD_NAMES } from "./consts";
import Variant from "./variant";
View semiTypedContext.tsx
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,
@isaac-martin
isaac-martin / list.md
Last active May 30, 2019
lists from yaml > react
View list.md

Have been talking about the best way to get data out of the yaml to then map in a component like the below

<ul>
  {listItems.map(item => (
    <li>
      {item}
    </li>
  ))}
</ul>
@isaac-martin
isaac-martin / cloudSettings
Last active Aug 3, 2020
Visual Studio Code Settings Sync Gist
View cloudSettings
{"lastUpload":"2020-08-03T13:31:40.214Z","extensionVersion":"v3.4.3"}
View groupBy.js
groupData = posts => {
const array = Object.values(posts);
const res = array.reduce((acc, curr) => {
if (!acc[curr.data.subreddit]) {
acc[curr.data.subreddit] = [];
}
// If this subreddit wasn't previously stored create an empty array
acc[curr.data.subreddit].push(curr); // Add the post to group
@isaac-martin
isaac-martin / cloudSettings
Created Sep 5, 2018
Visual Studio Code Settings Sync Gist
View cloudSettings
{"lastUpload":"2018-09-05T20:44:40.966Z","extensionVersion":"v3.1.2"}
@isaac-martin
isaac-martin / cloudSettings
Last active Sep 5, 2018
Visual Studio Code Settings Sync Gist
View cloudSettings
{"lastUpload":"2018-09-05T20:43:28.176Z","extensionVersion":"v3.1.2"}
View gist:8dd819106387f5af33b5732d9fefe17c
<script type="text/javascript">
(function(){ if(!window.jQuery) {
var script= document.createElement("script");
script.src = "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js";
script.async = true;
script.type = "text/javascript";
document.getElementsByTagName('head')[0].appendChild(script);
}})();
</script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/keen.js/3.4.1/keen.min.js"></script>
View h2melon-subscribe.html
<div id="mc_embed_signup">
<form action="//h2melon.us12.list-manage.com/subscribe/post?u=15a1ba46f2ef3436777ccec17&amp;id=36e7be12c9" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate news-form page-form" target="_blank" novalidate="true">
<div id="mc_embed_signup_scroll">
<label class="form-response" for="mce-email"></label>
<!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
<div style="position: absolute; left: -5000px;" aria-hidden="true"><input type="text" name="b_15a1ba46f2ef3436777ccec17_36e7be12c9" tabindex="-1" value=""></div>
<input type="email" value="" name="EMAIL" class="email" id="mce-email" placeholder="email address" required="">
<input type="submit" value="Sign Up" name="subscribe" id="mc-embedded-subscribe" class="button">
</div>
</form>