This file contains hidden or 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
| var toObservable = request => Rx.Observable.create(observer => { | |
| var req = request.end((err, res) => { | |
| if(err) { | |
| observer.onError(err) | |
| } else { | |
| observer.onNext(res) | |
| observer.onComplete() | |
| } | |
| }) | |
| return Rx.Disposable.create(() => { |
This file contains hidden or 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
| const combineObject = config => { | |
| const streams = _.values(config) | |
| const keys = _.keys(config) | |
| return Rx.Observable.combineLatest( | |
| ...streams, | |
| (...values) => _.zip(values, keys).reduce((acc, [value, key]) => { | |
| acc[key] = value | |
| return acc |
This file contains hidden or 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
| const pageSize = 10 | |
| const getPage = page => { | |
| const pageContent = _.range(0, pageSize).map(v => v + (page * pageSize)) | |
| if(page == 9) { | |
| return Rx.Observable.just({ | |
| nextPage: null, |
This file contains hidden or 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
| use std::mem; | |
| use std::slice; | |
| pub struct Pool { | |
| uncommited: usize, | |
| ptr: *mut u8 | |
| } | |
| impl Pool { |
OlderNewer