Skip to content

Instantly share code, notes, and snippets.

Karl Horky karlhorky

Block or report user

Report or block karlhorky

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View App.Combobox.js
import React, { useState, useEffect } from "react";
import "./packages/combobox/styles.css";
import {
} from "./packages/combobox/index";
View fetch-with-timeout.js
// Fetch with timeout
// Source:
const networkTimeoutError = new Error('Network request timeout')
function getTimeout({ timeout }) {
if (timeout && timeout.constructor === Promise) {
return timeout
if (typeof timeout === 'number') {
karlhorky /
Last active Jan 21, 2019
CSS is Complex. We can do better.

CSS is Complex. We can do better.

Posted on

Ok, thread time.

CSS is unnecessarily complex. And we can do better.

There have been side conversations here and there, but I want to consolidate the information and opinions here. This will be a running thread, and I'll add to it as new things crop up.

karlhorky /
Last active Dec 15, 2018
Huawei Matebook x Pro PCI-Express 2 lane bandwidth limitations with eGPU

Huawei Matebook x Pro PCI-Express 2 lane bandwidth limitations with eGPU

"In short, with current TB3 overheads, 2 lanes is enough to transfer data to the GPU. If you use a display connected to the external GPU, you'll see almost zero performance difference. If you want to use the internal display of your laptop, 2 lanes is not enough, and you'll need 4 lanes to shuffle the DisplayPort data back."

Full Thread:

Original Reference:

karlhorky / flow-deepreadonly.js
Last active Aug 21, 2018
Flow: DeepReadOnly utility function
View flow-deepreadonly.js
// Source:
// $ReadOnly doesn't recursively apply invariance to nested object types, and there
// doesn't seem to be any way to do this besides making a separate copy of obj A
// that is invariant. I still want the variant A around in case I want to mutate it
// in certain contexts.
// It would be nice to have some way to use an object as if it's fully, deeply
// invariant without needing to declare a separate variant and invariant type for it.
karlhorky / flow-Pick.js
Created Aug 21, 2018
Flow: Pick utility function to return a subset of keys of an object type
View flow-Pick.js
// Source:
// Flow Try:
// I've just came across with the need of defining an object type
// using a subset of another, or in other words, use some props
// definition of a certain object type and intersect this result
// (a reduced object type) with another set of props definitions
// to define a new type.
// I used to do this a lot with PropTypes using pick utility from
karlhorky / flow-Omit.js
Last active Aug 21, 2018
Flow: Omit utility function to remove keys of an object type by using $Diff
View flow-Omit.js
// Source:
// We can replicate $Omit non dynamic functionality by doing the following:
type T0 = {
k0: string,
k1: number,
k2: boolean
karlhorky / literalType.js
Created Aug 2, 2018
Flow Type: Literal Type Generic Type
View literalType.js
// @flow
// Originally from
const foo = 'FOO';
function literal(type) {
return { [type]: type };
karlhorky /
Created Jul 31, 2018
Check Flow types without @flow pragma comment

Originally from:

I use following solution which work great:

  1. .flowconfig file is placed to src folder.
  2. node_modules and flow-typed folders resides in root folder.
  3. Option all=true is enabled in .flowconfig file.
  4. flow-typed typings is included in .flowconfig file.
  5. Well-typed modules from node_modules folder that contain module own typings is included to .flowconfig file manually.
You can’t perform that action at this time.