Skip to content

Instantly share code, notes, and snippets.

Jason Awbrey jsonberry

Block or report user

Report or block jsonberry

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
nilsmehlhorn / matcher.ts
Last active Jan 31, 2020
Small and configurable full-text search on objects in TypeScript
View matcher.ts
export type Matcher<T> = (query: string) => T[];
export type ValueProject<T> = (target: T) => Array<string | number>;
export type MatcherFactory = <T>(targets: T[], project: ValueProject<T>) => Matcher<T>;
export const defaultProject = <T>(target: T) => Object.values(target);
const isMatchable = prop => typeof prop == 'number' || typeof prop == 'string'
jsonberry / helpful-javascript-utilities.js
Last active Apr 30, 2018
Helpful JavaScript Utilities
View helpful-javascript-utilities.js
// zip arrays together
// Catalin Dumitru @colin_dumitru
// Jason Awbrey @jsawbrey
const zip = (a, b) =>, i) => [n, b[i]])
// merge objects in an array together
// caution: properties are overridden if duplicated
// @a [{a},{b}]
// @returns [{a, b}]
// Jason Awbrey @jsawbrey
jsonberry / onload.js
Last active Jul 27, 2019
Window vs. Document Loading Events
View onload.js
Taken from:
According to Parsing HTML documents - The end,
The browser parses the HTML source and runs deferred scripts.
A DOMContentLoaded is dispatched at the document when all the HTML has been parsed and have run. The event bubbles to the window.
The browser loads resources (like images) that delay the load event.
A load event is dispatched at the window.
Therefore, the order of execution will be
DOMContentLoaded event listeners of window in the capture phase
DOMContentLoaded event listeners of document
Dorus / index.js
Last active Feb 15, 2020 — forked from xgrommx/index.js
How we can make methods of observable via other methods
View index.js
const flatMap = (fn, stream, resultSelector) =>
stream.flatMap((x, xi) => fn(x).map((y, yi) => resultSelector(x, y, xi, yi)));
const flatMapLatest = (fn, stream) =>
stream.publish(s => s.flatMap(v => fn(v).takeUntil(s)));
const flatMapLatest = (fn, stream, resultSelector) => stream.publish(s => {
return s.flatMap(v => fn(v), resultSelector).takeUntil(s));
staltz /
Last active Apr 8, 2020
The introduction to Reactive Programming you've been missing
You can’t perform that action at this time.