This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# TYPE worker_pool_queue_size gauge | |
worker_pool_queue_size{pool_name="vert.x-internal-blocking",pool_type="worker"} 0.0 | |
worker_pool_queue_size{pool_name="vert.x-worker-thread",pool_type="worker"} 0.0 | |
# TYPE worker_pool_active gauge | |
worker_pool_active{pool_name="vert.x-internal-blocking",pool_type="worker"} 0.0 | |
worker_pool_active{pool_name="vert.x-worker-thread",pool_type="worker"} 1.0 | |
# TYPE jvm_gc_live_data_size_bytes gauge | |
jvm_gc_live_data_size_bytes 0.0 | |
# TYPE jvm_buffer_count_buffers gauge | |
jvm_buffer_count_buffers{id="mapped - 'non-volatile memory'"} 0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type None = false | |
const none = false | |
type Equality<A> = (left: A, right: A) => boolean | |
function areSameReference<A>(left: A, right: A): boolean { | |
return left === right | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function zoom(dayStart: number, dayEnd: number, zoomFactor: number): [number, number] { | |
// What is the middle of the time range? | |
// When zooming in or out, the middle of the time range should stay the middle. | |
const dayMiddle = (dayEnd + dayStart) / 2 | |
// Determine what the new time range should be using the `zoomFactor`. | |
const oldTimeRange = dayEnd - dayStart | |
const newTimeRange = oldTimeRange * zoomFactor | |
// Calculate the new boundaries of the time range: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type GraphProps = { | |
activities: Activity[] | |
dayStart: number | |
dayEnd: number | |
onZoomIn: () => void | |
onZoomOut: () => void | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { TestScheduler } from 'rxjs/testing' | |
import { exhaustMapWithLatest } from './exhaustMapWithLatest' | |
import { of } from 'rxjs' | |
describe('exhaustMapWithLatest', () => { | |
it('should act as `map` when the inner `Observable<..>` completes directly', () => { | |
const scheduler = new TestScheduler((actual, expected) => { | |
expect(actual).toEqual(expected) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum HListType { | |
HCons, | |
HNil | |
} | |
type HNil = { type: typeof HListType.HNil } | |
type HCons<Head, Tail extends HList<any, any>> = { | |
type: typeof HListType.HCons | |
head: Head | |
tail: Tail | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Condition<O> = (o: O) => boolean | |
type QueryableProperty<Alias extends string, Subject, Property> = { | |
eq(other: Property): Condition<{ [K in Alias]: Subject }> | |
eq<OtherAlias extends string, OtherSubject>(other: QueryableProperty<OtherAlias, OtherSubject, Property>): Condition<{ [K in Alias]: Subject } & { [K in OtherAlias]: OtherSubject }> | |
} | |
type Queryable<Alias extends string, Subject> = { [KS in keyof Subject]: QueryableProperty<Alias, Subject, Subject[KS]> } | |
type Query<O> = { | |
where(condition: Condition<O>): Query<O> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Hkts<A> = { | |
Id: A | |
Array: A[] | |
} | |
type HktToken = keyof Hkts<any> | |
type Continuation<T extends HktToken, A> = <B>(c: (a: A) => Hkts<B>[T]) => Hkts<B>[T] | |
type FlatMap<T extends HktToken> = <A, B>(fa: Hkts<A>[T], fn: (a: A) => Hkts<B>[T]) => Hkts<B>[T] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Lens<Outer, Inner> { | |
static create<O>(): Lens<O, O> { | |
return new Lens(o => o, o => o, []) | |
} | |
constructor(public readonly read: (outer: Outer) => Inner, public readonly write: (inner: Inner, outer: Outer) => Outer, public readonly path: Array<string | number | Symbol>) { } | |
property<K extends keyof Inner>(k: K): Lens<Outer, Inner[K]> { | |
return new Lens( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Lazy<A> = () => A | |
const Lazy = { | |
map<A, B>(l: Lazy<A>, fn: (a: A) => B): Lazy<B> { | |
return lazy(() => fn(l())) | |
} | |
} | |
function lazy<A>(fn: () => A): Lazy<A> { | |
let memoized: { value: A } | false = false |
NewerOlder