A Pen by ashish singh on CodePen.
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
//emit immediately, then every 5s | |
const source = Rx.Observable.timer(0, 5000); | |
//switch to new inner observable when source emits, emit items that are emitted | |
const example = source.switchMap(() => Rx.Observable.interval(500)); | |
//output: 0,1,2,3,4,5,6,7,8,9...0,1,2,3,4,5,6,7,8 | |
const subscribe = example.subscribe(val => console.log(val)); | |
//emit every click | |
const sourceTwo = Rx.Observable.fromEvent(document, 'click'); | |
//if another click comes within 3s, message will not be emitted |
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 source = Rx.Observable | |
.range(1, 2) | |
.flatMap(function (x) { | |
return Rx.Observable.range(x, 2); | |
}); | |
var subscription = source.subscribe( | |
function (x) { console.log('Next: ' + x); }, | |
function (err) { console.log('Error: ' + err); }, | |
function () { console.log('Completed'); }); |
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
private _updateView() { | |
if (this._context.$implicit) { | |
if (!this._thenViewRef) { | |
this._viewContainer.clear(); | |
this._elseViewRef = null; | |
if (this._thenTemplateRef) { | |
this._thenViewRef = | |
this._viewContainer.createEmbeddedView(this._thenTemplateRef, this._context); | |
} | |
} |
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
<div *ngIf="$userObservable | async; else loading; let user"> | |
Hello {{user.last}}, {{user.first}}! | |
</div> | |
<ng-template #loading>Fetching data...</ng-template> |
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
function flatten(arr) { | |
var i = 0; | |
while (i < arr.length) { | |
arr = arr.reduce(function (prev, curr) { | |
return prev.concat(curr); | |
}, []); | |
i++; | |
} | |
return arr; | |
} |
I hereby claim:
- I am ashish173 on github.
- I am ashishait (https://keybase.io/ashishait) on keybase.
- I have a public key ASBd6vMalHeeL01NO8cp45RIAF8VewFO3Gw99G-i5PuA4Ao
To claim this, I am signing this object:
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
// SPDX-License-Identifier: GPL-3.0 | |
pragma solidity >=0.4.22 <0.9.0; | |
library TestsAccounts { | |
function getAccount(uint index) pure public returns (address) { | |
address[15] memory accounts; | |
accounts[0] = 0x5B38Da6a701c568545dCfcB03FcB875f56beddC4; | |
accounts[1] = 0xAb8483F64d9C6d1EcF9b849Ae677dD3315835cb2; |
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
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.0; | |
interface AggregatorV3Interface { | |
function decimals() external view returns (uint8); | |
function description() external view returns (string memory); | |
function version() external view returns (uint256); |
OlderNewer