Skip to content

Instantly share code, notes, and snippets.

Lee Byron leebyron

Block or report user

Report or block leebyron

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 for-in-react-example.jsx
var children = []
for (var key in terms) {
if (terms.hasOwnProperty(key)) {
<React.Fragment key={key}>
leebyron / .flowconfig
Last active Jul 9, 2018
We couldn’t find that file to show.
View Super-Rough-Record-Class-Types.js
declare function Record(): any
const RecordInstance = Record({
class _Foo extends RecordInstance {}
exports.Foo = _Foo
View Flow-Predicate-Checks.js
type HasFoo = { kind: "Foo" }
type HasBar = { kind: "Bar", baz: string }
class Other {
baz = "cool"
function hasBar(obj: HasFoo | HasBar | Other): boolean %checks {
return obj instanceof Other
leebyron / PriorityQueue.js
Last active Jan 28, 2019
PriorityQueue.js uses a binary heap to ensure the highest priority item is always available to dequeue, and sorts on enqueue. A dynamically resizing Array can be used to model the binary heap, for a simpler and more efficient implementation.
View PriorityQueue.js
* For compare function return:
* - Less than zero: item1 has higher priority than item2.
* - Zero: same.
* - Greater than zero: item1 has lower priority than item2.
export type CompareFunction<T> = (item1: T, item2: T) => number;
export class PriorityQueue<T> {
_items: Array<T>;
leebyron / index.js
Last active Aug 8, 2017
requirebin sketch
View index.js
const Observable = require("zen-observable");
let sink;
const list = [];
const error = new Error();
new Observable(_sink => {
sink = _sink;
return () => list.push('cleanup');

Keybase proof

I hereby claim:

  • I am leebyron on github.
  • I am leeb ( on keybase.
  • I have a public key ASBnVuESLbEjmR4Ac79vgbgOLVoPtA6GAZSV-MxsHpJ1_Ao

To claim this, I am signing this object:

leebyron / sort-keys.js
Created Jan 30, 2017
Sort values by key order performance
View sort-keys.js
var keys = [];
var results = [];
var keyCount = 100;
var iterations = 10000;
//generate keys 0 to <keycount>
for (var i=0; i < keyCount; i++) {
results.push({ id: i })
leebyron / maybeFilter.js
Last active Jun 29, 2016
An array filter function which does not create a new array if no items are removed.
View maybeFilter.js
function maybeFilter(array, predicate) {
var newArray;
array.forEach((item, i) => {
if (predicate(item)) {
if (newArray) {
} else if (!newArray) {
newArray = array.slice(0, i)

Languages have various allowances for white-space. This is a short exploration of parsers I found and what they claim to accept


Oct  Dec Char  Hex  Key Esc
\000   0  NUL  \x00  ^@ \0 (Null byte)
\010   8   BS  \x08  ^H \b (Backspace)
\011   9   HT  \x09  ^I \t (Horizontal tab)
\012  10   LF  \x0A  ^J \n (Line feed)  (Default UNIX NL)
You can’t perform that action at this time.