This file contains 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 kotlinx.coroutines.experimental.Unconfined | |
import kotlinx.coroutines.experimental.channels.ReceiveChannel | |
import kotlinx.coroutines.experimental.channels.consumes | |
import kotlinx.coroutines.experimental.channels.produce | |
import kotlinx.coroutines.experimental.selects.whileSelect | |
import kotlin.coroutines.experimental.CoroutineContext | |
fun <T, R> ReceiveChannel<T>.switchMap(context: CoroutineContext = Unconfined, | |
transform: suspend (T) -> ReceiveChannel<R>): ReceiveChannel<R> { | |
val input = this |
This file contains 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
diff -ru api/myapp/Gemfile noapi/myapp/Gemfile | |
--- api/myapp/Gemfile 2017-05-30 16:10:00.000000000 +0200 | |
+++ noapi/myapp/Gemfile 2017-05-30 16:09:43.000000000 +0200 | |
@@ -12,21 +12,8 @@ | |
gem 'sqlite3' | |
# Use Puma as the app server | |
gem 'puma', '~> 3.0' | |
-# Use SCSS for stylesheets | |
-gem 'sass-rails', '~> 5.0' | |
-# Use Uglifier as compressor for JavaScript assets |
This file contains 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
//: Playground - noun: a place where people can play | |
import UIKit | |
import RxSwift | |
protocol ListSource { | |
associatedtype ItemT | |
func getItems(index: Int) -> [ItemT] | |
} |
This file contains 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
class BaseActivity extends AppCompatActivity { | |
private ActivityComponent activityComponent; | |
@Override public void onCreate(Bundle savedInstanceState) { | |
activityComponent = DaggerActivityComponent.builder() | |
.appComponent(((MyApp) getApplicationContext()).getComponent()) | |
.build(); | |
activityComponent.inject(this); | |
} |
This file contains 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 Foundation | |
func measure(op: () -> ()) -> Double { | |
let startTime = CFAbsoluteTimeGetCurrent() | |
op() | |
let elapsed = CFAbsoluteTimeGetCurrent() - startTime | |
return Double(elapsed) | |
} |
This file contains 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.List; | |
import java.util.concurrent.TimeUnit; | |
import rx.Observable; | |
import rx.subjects.PublishSubject; | |
public class KonamiTimer { | |
private final PublishSubject<Integer> input; | |
private final int triggerCount; |
This file contains 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 android.util.Log; | |
import rx.Observable; | |
import rx.Observer; | |
class Either<T> { | |
private final T value; | |
private final Throwable throwable; | |
public static <T> Either<T> ofValue(T value) { |
This file contains 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
@Module(injects = MyActivityModule.class) | |
class MotherModule { | |
// ...snip | |
} | |
@Module( | |
addsTo = MotherModule.class, | |
injects = {MyActivity.class, MyFragment.class} | |
) | |
class MyActivityModule { |
This file contains 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
configurations { | |
androidTestCompile.exclude group: 'com.android.support', module: 'support-v4' | |
} |
NewerOlder