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
| //This doesnt work (Fails on second try) | |
| var cachedObservable; | |
| var observableFms = Rx.Observable.If(function() { | |
| return cachedObservable !== undefined; | |
| }, | |
| cachedObservable, | |
| Rx.Observable.Defer(function() { | |
| cachedObservable = service.getObservableFmsAuswertungForTour(data.ID); | |
| return cachedObservable; |
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
| // Copyright (c) Microsoft Corporation. All rights reserved. | |
| // This code is licensed by Microsoft Corporation under the terms | |
| // of the MICROSOFT REACTIVE EXTENSIONS FOR JAVASCRIPT AND .NET LIBRARIES License. | |
| // See http://go.microsoft.com/fwlink/?LinkId=186234. | |
| (function () { | |
| var a; | |
| var b; | |
| var c = this; | |
| var d = "Index out of range"; | |
| if (typeof ProvideCustomRxRootObject == "undefined") b = c.Rx = {}; |
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 scheduler = new TestScheduler(); | |
| var source = scheduler.CreateHotObservable( | |
| new Recorded<Notification<int>>(600, Notification.CreateOnNext(1)), | |
| new Recorded<Notification<int>>(1200, Notification.CreateOnNext(2)), | |
| new Recorded<Notification<int>>(1600, Notification.CreateOnNext(3)), | |
| new Recorded<Notification<int>>(2000, Notification.CreateOnNext(4)), | |
| new Recorded<Notification<int>>(2400, Notification.CreateOnNext(5)), | |
| new Recorded<Notification<int>>(3000, Notification.CreateOnNext(6)), | |
| new Recorded<Notification<int>>(3500, Notification.CreateOnNext(7)) |
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
| using System; | |
| namespace Factorial | |
| { | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| Console.WriteLine("factorial of 3 using simple recursion: " + Factorial(3)); | |
| Console.WriteLine("factorial of 3 using accumulator passing style: " + FactorialAcc(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
| var keys = { | |
| UP: 38, | |
| DOWN: 40, | |
| CTRL: 17 | |
| } | |
| var selectKeyCode = function(event){ return event.keyCode; }; | |
| var selectDown = function(){ return "down";}; |
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
| public static class SignalRRxExtensions | |
| { | |
| public static void PublishOnClient<THub, T>(this IObservable<T> observable, Expression<Func<THub, dynamic>> expression) where THub : Hub, new () | |
| { | |
| var connectionManager = AspNetHost.DependencyResolver.Resolve<IConnectionManager>(); | |
| dynamic clients = connectionManager.GetClients<THub>(); |
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 subject = new Rx.Subject(); | |
| var getObservable = function (eventName) { | |
| return subject.asObservable() | |
| .where(function (x) { return x.EventName === eventName; }) | |
| .takeUntil(function (x) { return x.Type === "onComplete"; }) | |
| .selectMany(function (x) { | |
| return x.Type === "onNext" ? Rx.Observable.returnValue(x.Data) : | |
| x.Type === "onError" ? Rx.Observable.throwException(x.Data) : | |
| Rx.Observable.empty(); |
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
| Rx.Observable.forkJoin = function (sources) { | |
| var tempSources = arguments.length > 1 ? arguments : sources; | |
| return Rx.Observable | |
| .fromArray(tempSources) | |
| .selectMany(function (o, i) { | |
| return o.takeLast(1).select(function (value) { return { i: i, value: value }; }); | |
| }) | |
| .aggregate({ array: [], count: 0 }, function (results, result) { |
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
| Rx.Observable.returnValue(3).merge(Rx.Observable.returnValue(2)).subscribe(function(x){console.log(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
| Rx.Observable.fromArray([1, 2, 3]) | |
| .concat(Rx.Observable.throwException("woah nellie!")) | |
| .retry(3) | |
| .onErrorResumeNext() | |
| .subscribe( | |
| function (next) { | |
| console.log(next); | |
| }); | |
| 1 | |
| 2 |