Skip to content

Instantly share code, notes, and snippets.


Jared Palmer jaredpalmer

View GitHub Profile
jaredpalmer /
Last active Sep 1, 2021
OAuth 2.0 Device Flow

OAuth Device Flow

This is flow used by apps on Apple TV / Roku. However, it is also useful for CLIs.

Here is my rundown. Please correct me in comments if something is wrong or if there is a better way to do this.

Device pings the server to begin activation process

jaredpalmer / MarkdownPage.tsx
Created Feb 17, 2021
Get headers from MDX in Next.js
View MarkdownPage.tsx
import {MDXProvider} from '@mdx-js/react';
import {MDXComponents} from 'components/MDX/MDXComponents';
import {Toc} from 'components/Toc/Toc';
import * as React from 'react';
export interface MarkdownProps<Frontmatter> {
meta: Frontmatter;
children?: React.ReactNode;
View assignExperiment.ts
import { crc32 } from 'common/components/Features/Experiment/crc32';
import { Config } from 'common/api/models/Config';
const sortBy = require('lodash.sortby');
export interface Experiments {
[name: string]: Variant[];
export interface Variant {
name: string;
jaredpalmer /
Last active Jan 9, 2021
Formik Tutorial

Formik Tutorial Outline

We're going to build a multi-step wizard for a jobs-to-be-done customer research questionaire from scratch.

Before we start

  • Installation
  • What we're building
  • Getting help
jaredpalmer /
Created Sep 26, 2020 — forked from ibraheem4/
Installing Postgres via Brew (OSX)

Installing Postgres via Brew


Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
View stale-app-link.js
View brotli.js
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at
* Unless required by applicable law or agreed to in writing, software distributed under
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
jaredpalmer / replaceValues.ts
Last active Aug 9, 2020
Replace all values of a given key
View replaceValues.ts
* Return a copy of an object, but with values of a key replaced with value of provided key-value object.
* Useful for duplicating highly nested object, but generating new values for a key (e.g. `id`)
* @param obj An object
* @param keyToReplace The key of the values needed to be swapped
* @param mapOfOldToNewValues A key-value object with a keys of old values mapped to new ones (used for swapping)
* @example
View SuspenseRedirect.tsx
import { globalHistory, navigate, RedirectProps, History } from '@reach/router';
import React from 'react';
type ReachHistory = History & {
_onTransitionComplete: () => void;
* Why is `SuspenseRedirect` necessary when @reach/router has `Redirect`?
jaredpalmer /
Created Jul 21, 2020
Search String parser
package org.formium.util;
import java.util.HashMap;
import java.util.Map;
import java.util.StringJoiner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class SearchUtil {
public static Map<String,String> parseSearchQuery(String query) {