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 fibonacci = new BehaviorSubject(1); | |
| fibonacci.next(1); | |
| fibonacci.next(2); | |
| fibonacci.next(3); | |
| fibonacci.next(5); | |
| fibonacci.next(8); | |
| console.log(fibonacci.value); |
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 subject = new Subject(); | |
| const subscription = subject.subscribe(value => console.log(value)); | |
| subject.next('foo'); | |
| subject.next('bar'); | |
| subscription.unsubscribe(); |
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
| import { fromEvent } from 'rxjs'; | |
| import io from 'socket.io-client'; | |
| const client = io().connect(); | |
| const listen = (event: string) => fromEvent(client, event); | |
| listen('message').subscribe((message) => console.log(message)); |
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
| subject.pipe( | |
| map(x => x * x), | |
| ); |
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
| import { fromEvent, Subject } from 'rxjs'; | |
| import { map, shareReplay, switchMap } from 'rxjs/operators'; | |
| import io from 'socket.io-client'; | |
| const $token = new Subject(); | |
| const $client = $token.pipe( | |
| map((token) => { | |
| if (null == token || '' === token) { | |
| return {}; | |
| } |
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 subject = new Subject(); | |
| subject.next(1); | |
| subject.next(2); | |
| subject.next(3); |
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 subject = new Subject(); | |
| subject.subscribe(value => console.log(value)); | |
| subject.next('lorem'); | |
| subject.next('ipsum'); | |
| subject.next('dolor'); |
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 subject = new Subject(); | |
| subject.subscribe( | |
| (value) => console.log(value), | |
| (error) => console.error(error), | |
| () => console.log('özne sonlandı'), | |
| ); | |
| subject.complete(); |
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
| // credit: https://codesandbox.io/s/all-combinations-of-words-v14d9 | |
| function combinations(words: string[]): string[][] { | |
| const combs: string[][] = [[]]; | |
| for (const word of words) { | |
| combs.push( | |
| ...combs.map((comb) => { | |
| return [...comb, word]; | |
| }) | |
| ); |
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
| /^[aeıioöuüAEIİOÖUÜ]$|^[bcçdfgğhjklmnprsştvyzBCÇDFGĞHJKLMNPRSŞTVYZ]$|[aeıioöuüAEIİOÖUÜ](?=[bcçdfgğhjklmnprsştvyzBCÇDFGĞHJKLMNPRSŞTVYZ][aeıioöuüAEIİOÖUÜ][bcçdfgğhjklmnprsştvyzBCÇDFGĞHJKLMNPRSŞTVYZ]?)|[bcçdfgğhjklmnprsştvyzBCÇDFGĞHJKLMNPRSŞTVYZ][aeıioöuüAEIİOÖUÜ](?=$|[^aeıioöuüAEIİOÖUÜbcçdfgğhjklmnprsştvyzBCÇDFGĞHJKLMNPRSŞTVYZ]|[bcçdfgğhjklmnprsştvyzBCÇDFGĞHJKLMNPRSŞTVYZ][aeıioöuüAEIİOÖUÜ])|[aeıioöuüAEIİOÖUÜ][bcçdfgğhjklmnprsştvyzBCÇDFGĞHJKLMNPRSŞTVYZ]|(?<=^|[^aeıioöuüAEIİOÖUÜbcçdfgğhjklmnprsştvyzBCÇDFGĞHJKLMNPRSŞTVYZ])[bcçdfgğhjklmnprsştvyzBCÇDFGĞHJKLMNPRSŞTVYZ][aeıioöuüAEIİOÖUÜ][bcçdfgğhjklmnprsştvyzBCÇDFGĞHJKLMNPRSŞTVYZ][bcçdfgğhjklmnprsştvyzBCÇDFGĞHJKLMNPRSŞTVYZ](?=[bcçdfgğhjklmnprsştvyzBCÇDFGĞHJKLMNPRSŞTVYZ][aeıioöuüAEIİOÖUÜ][bcçdfgğhjklmnprsştvyzBCÇDFGĞHJKLMNPRSŞTVYZ])|[bcçdfgğhjklmnprsştvyzBCÇDFGĞHJKLMNPRSŞTVYZ][bcçdfgğhjklmnprsştvyzBCÇDFGĞHJKLMNPRSŞTVYZ][aeıioöuüAEIİOÖUÜ]([bcçdfgğhjklmnprsştvyzBCÇDFGĞHJKLMNPRSŞTVYZ](?=[^aeıioöuüAEIİOÖUÜbcçdfgğhjklmnprsştvyzBCÇDFGĞHJKLMNPRSŞTVYZ]|$|[bcçdfgğhjklmnprsştvyz |