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 java.util.concurrent.TimeUnit; | |
| import org.junit.Test; | |
| import rx.Observable; | |
| import rx.functions.Action0; | |
| import rx.functions.Action1; | |
| import rx.functions.Func1; | |
| import rx.observers.TestSubscriber; | |
| public class ReplayTest { |
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 org.junit.Test; | |
| import java.util.concurrent.TimeUnit; | |
| import rx.Observable; | |
| import rx.functions.Func3; | |
| import rx.schedulers.Schedulers; | |
| import rx.subjects.PublishSubject; | |
| /** |
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
| package com.dramafever.android.lib.rxjava; | |
| import org.junit.Test; | |
| import org.junit.runner.RunWith; | |
| import org.mockito.Mock; | |
| import org.mockito.runners.MockitoJUnitRunner; | |
| import rx.Subscriber; | |
| import rx.functions.Action0; | |
| import rx.functions.Action1; |
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 Debug.Trace | |
| main :: IO() | |
| main = do | |
| let sorted = bubbleSort [6, 5, 3, 1, 8, 7, 2, 4] :: [Integer] | |
| print sorted | |
| bubbleSort :: (Ord a, Show a) => [a] -> [a] | |
| --bubbleSort lst | trace ("sorting: " ++ show lst) False = undefined | |
| bubbleSort [] = [] |
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 Debug.Trace | |
| main :: IO() | |
| main = do | |
| let sorted = mergeSort [6, 5, 3, 1, 8, 7, 2, 4] | |
| print sorted | |
| mergeSort :: (Ord a, Show a) => [a] -> [a] | |
| -- mergeSort lst | trace ("sorting: " ++ show lst) False = undefined | |
| mergeSort [] = [] |
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 Data.Char | |
| import Debug.Trace | |
| import System.IO | |
| main :: IO() | |
| main = do | |
| hSetBuffering stdin NoBuffering | |
| putStrLn "Sample: counting words with a given letter" | |
| putStrLn "Input letter to count:" | |
| letter <- getChar |
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 class DataBindingComponent<DataType> implements Scene.Component { | |
| private final Bindable target; | |
| private final Data data; | |
| public DataBindingComponent(Data data, Bindable<DataType> target) { | |
| this.data = data; | |
| this.target = target; | |
| } |
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
| windowMap :: ( a -> a -> b) -> [a] -> [b] | |
| windowMap func list = | |
| let zipped = zip list (tail list) | |
| in map (uncurry func) zipped | |
| windowScan :: (b -> a -> a -> b) -> b -> [a] -> [b] | |
| windowScan func accumulator list = | |
| let zipped = zip list (tail list) | |
| func' = \ acc -> uncurry (func acc) | |
| in scanl func' accumulator zipped |
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
| Promise<ResponseTypeA> responseA; | |
| Promise<ResponseTypeB> responseB; | |
| p1.then(new PromiseAction<A>() { | |
| public void call(A response) { | |
| // do something with the response | |
| } | |
| }); | |
| p2.then(new PromiseAction<B>() { |
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
| Action1 onNext = new Action1<R>() { | |
| @Override | |
| public void call(R composedResult) { | |
| //do something | |
| } | |
| }; | |
| Observable.zip(observable1, observable2, | |
| new Func2<T1, T2, R) { | |
| @Override |