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
@karlhorky
karlhorky / engine-ua-sniffer.js
Created Jul 10, 2019 — forked from domenic/engine-ua-sniffer.js
Rendering engine UA sniffer
View engine-ua-sniffer.js
// This is a minimal UA sniffer, that only cares about the rendering/JS engine
// name and version, which should be enough to do feature discrimination and
// differential code loading.
//
// This is distinct from things like https://www.npmjs.com/package/ua-parser-js
// which distinguish between different branded browsers that use the same rendering
// engine. That sort of distinction is maybe useful for analytics purposes, but
// for differential code loading it is overcomplicated.
//
// This is meant to demonstrate that UA sniffing is not really that hard if you're
View App.Combobox.js
import React, { useState, useEffect } from "react";
import "./packages/combobox/styles.css";
import {
Combobox,
ComboboxInput,
ComboboxList,
ComboboxOption,
ComboboxPopup
} from "./packages/combobox/index";
View fetch-with-timeout.js
// Fetch with timeout
// Source: https://github.com/whatwg/fetch/issues/179#issuecomment-457698748
const networkTimeoutError = new Error('Network request timeout')
function getTimeout({ timeout }) {
if (timeout && timeout.constructor === Promise) {
return timeout
}
if (typeof timeout === 'number') {
@karlhorky
karlhorky / css-is-complex.md
Last active Jan 21, 2019
CSS is Complex. We can do better.
View css-is-complex.md

CSS is Complex. We can do better.

Posted on https://twitter.com/karlhorky/status/1082622697325166592

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
karlhorky / matebook-x-pro-pcie-x2-bandwidth-limitations.md
Last active Dec 15, 2018
Huawei Matebook x Pro PCI-Express 2 lane bandwidth limitations with eGPU
View matebook-x-pro-pcie-x2-bandwidth-limitations.md

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."

https://www.reddit.com/r/Huawei/comments/8niq84/matebook_x_pro_i7_3d_mark_scores_razer_core/dzx3n36/

Full Thread: https://www.reddit.com/r/Huawei/comments/8niq84/matebook_x_pro_i7_3d_mark_scores_razer_core/

Original Reference:

@karlhorky
karlhorky / flow-deepreadonly.js
Last active Aug 21, 2018
Flow: DeepReadOnly utility function
View flow-deepreadonly.js
// Source: https://github.com/facebook/flow/issues/5844
// $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.
You can’t perform that action at this time.