Skip to content

Instantly share code, notes, and snippets.

View iamkevingreen's full-sized avatar
💭
🍝 🍝 🍝 🍝 🍝 🍝

Kevin Green iamkevingreen

💭
🍝 🍝 🍝 🍝 🍝 🍝
View GitHub Profile
@mshafrir
mshafrir / states_hash.json
Created May 9, 2012 17:05
US states in JSON form
{
"AL": "Alabama",
"AK": "Alaska",
"AS": "American Samoa",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DE": "Delaware",
@yossorion
yossorion / what-i-wish-id-known-about-equity-before-joining-a-unicorn.md
Last active April 7, 2024 22:55
What I Wish I'd Known About Equity Before Joining A Unicorn

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

@dan-dr
dan-dr / index.js
Created March 28, 2019 21:23
Sanity Backup to Dropbox on webtask.io
const sanity = require('@sanity/client')
const fs = require('fs')
const EOL = require('os').EOL
const flatMap = require('lodash.flatmap')
const { subDays, isBefore } = require('date-fns')
const sanityExport = require('@sanity/export')
/**
* @param context {WebtaskContext}
*/
/*
home.js
--
This script takes the JSON data from the home page for posts and tweets and
randomly displays them into a randomly selected template which is then
Variables from Home HTML:
@kmelve
kmelve / BlockEditor.js
Created September 14, 2019 11:56
Custom portable text / block editor for Sanity with markdown paste and stats
import React, { Component, Fragment } from 'react'
import { BlockEditor } from 'part:@sanity/form-builder'
import Switch from 'part:@sanity/components/toggles/switch'
import css from './BlockEditor.module.css'
import { handlePaste } from './handlePaste'
export default class CustomEditor extends Component {
state = {
customPaste: false
}
@marcio0
marcio0 / FilteredReference.js
Last active September 26, 2022 10:29
filtered reference field on sanity
import React from "react";
import PropTypes from "prop-types";
import { has } from "lodash";
import PatchEvent, { set, unset } from "part:@sanity/form-builder/patch-event";
import ReferenceInput from "@sanity/form-builder/lib/inputs/ReferenceInput";
import { withDocument } from "part:@sanity/form-builder";
import { map } from "rxjs/operators";
import client from "part:@sanity/base/client";
import { createWeightedSearch } from "../../utils/search";
import { observeForPreview } from "part:@sanity/base/preview";
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,
/* Get 12 most recent instagram thumbnails from a public account
* resolution = 0 - 4
* 0 => 150
* 1 => 240
* 2 => 320
* 3 => 480
* 4 => 640
*/
export default function(username, resolution = 4) {
return fetch(`https://www.instagram.com/${username}/?__a=1`)
@mikehwagz
mikehwagz / .eleventy.js
Created September 24, 2020 16:19
blur-up image picoapp component in a 11ty sanity setup
// just the shortcodes you'll need in eleventy config
const cx = require('nanoclass')
const imageUrlBuilder = require('@sanity/image-url')
const sanityClient = require('./util/sanityClient')
const builder = imageUrlBuilder(sanityClient)
function urlFor(image, width, height) {
if (width) {
if (height) {
return builder
<template>
<div class="m:fix m:fill m:f aic whiskey__wrap">
<div class="scroll-element m:nowrap wct m:f aic pt130 m:pt0" ref="scrollElement">
<ul class="whiskey l y m:f aic">
<li
v-for="(item, i) in page.whiskey_listing"
:key="`${item.uid}-${i}`"
class="rel y mb90 m:mb0"
>
<n-link