Skip to content

Instantly share code, notes, and snippets.

View estrattonbailey's full-sized avatar

Eric Bailey estrattonbailey

View GitHub Profile
import fetch from "node-fetch"
import sanityClient from "@sanity/client"
import * as fs from "fs"
import { fetchAPI } from "./fetchApi"
import gql from "graphql-tag"
const API_URL = "[add yours here]"
export async function fetchAPI(query, { variables = null } = {}) {
const QUERY = typeof query === "string" ? query : query?.loc.source.body

Companies building interesting things. No specific order.

  • Vercel
  • Stripe
  • Coinbase
  • WorkOS
  • Substack
  • Render
  • Figma
  • Retool
@ndimatteo
ndimatteo / _Sanity - Async Conditional Fields.md
Last active June 22, 2021 13:33
Sanity Conditional Fields (async)

Async Conditional Fields for Sanity

✨ Asynchronous ✨ multiple fields ✨ Sanity UI ✨ Easy! ✨

Show multiple fields in an object field, based on a condition set through the "options" object. Simply return true/false from "condition" function, even asynchronously!

/* 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`)
@alisdair
alisdair / intensify.sh
Created May 21, 2019 23:44
intensifies Slack emoji creator
#!/bin/bash
# Generate a `:something-intensifies:` Slack emoji, given a reasonable image
# input. I recommend grabbing an emoji from https://emojipedia.org/
set -euo pipefail
# Number of frames of shaking
count=10
# Max pixels to move while shaking
@getify
getify / 1.js
Last active September 29, 2021 11:58
experiment: mimicking React's new "useState()" hook for stand-alone functions, including "custom hooks"
"use strict";
[foo,bar] = TNG(foo,bar);
// NOTE: intentionally not TNG(..) wrapping useBaz(), so that it's
// basically like a "custom hook" that can be called only from other
// TNG-wrapped functions
function foo(origX,origY) {
var [x,setX] = useState(origX);
var [y,setY] = useState(origY);
@iaverin
iaverin / rest35.py
Last active August 9, 2024 13:43
Simple and functional REST server for Python (3.5) using no dependencies beyond the Python standard library. Ported from https://gist.github.com/tliron/8e9757180506f25e46d9
#!/usr/bin/env python
'''
Simple and functional REST server for Python (3.5) using no dependencies beyond the Python standard library.
Ported from original lib for Python 2.7 by Liron (tliron @ github.com) https://gist.github.com/tliron/8e9757180506f25e46d9
Features:
* Map URI patterns using regular expressions
* Map any/all the HTTP VERBS (GET, PUT, DELETE, POST)
* All responses and payloads are converted to/from JSON for you
* Easily serve static files: a URI can be mapped to a file, in which case just GET is supported
@hhff
hhff / ContainerBase.js
Created July 31, 2018 15:29
React on Ember
import React, { Component } from "react";
import get from "utils/get";
// Use extend ContainerBase in your Route Containers and use
// the provided lifecycle hooks to load data. This way you'll
// have a predictable edge to know when data is loaded for your
// Route - super useful for serverside rendering your app!
class ContainerBase extends Component {
state = {
@nickbytes
nickbytes / reset.css
Last active September 23, 2019 22:48
my css reset
html { box-sizing: border-box }
*, *:before, *:after { box-sizing: inherit; }
body { margin: 0; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body, h1, h2, h3, h4, h5, h6, p, ol, ul {
margin: 0;
padding: 0;
font-weight: normal;
}

tweet-css

Smallest possible CSS-in-JS library.