Skip to content

Instantly share code, notes, and snippets.

View mtomczynski's full-sized avatar

Maciek Tomczyński mtomczynski

  • Cracow
View GitHub Profile

Keybase proof

I hereby claim:

  • I am mtomczynski on github.
  • I am mtomczynski (https://keybase.io/mtomczynski) on keybase.
  • I have a public key ASCi4cx4YeIPheCuQXGTV0jb54QYVkEi6ebO58xRObbafgo

To claim this, I am signing this object:

@mtomczynski
mtomczynski / build.gradle.kts
Created August 25, 2019 07:28
Project level gradle to set configuration for all modules
subprojects {
afterEvaluate { project ->
if (project.hasProperty('android')) {
android {
buildToolsVersion Config.buildTools
compileSdkVersion Config.compileSdk
defaultConfig {
minSdkVersion Config.minSdk
targetSdkVersion Config.targetSdk
sealed class SimpleResponse<T> {
data class Success<T>(val value: T) : SimpleResponse<T>()
data class Failure<T>(val throwable: Throwable) : SimpleResponse<T>()
}
// Usage
fun <T> readSimpleResponse(response: SimpleResponse<T>) {
when(response) {
is SimpleResponse.Success -> { response.value }
is SimpleResponse.Failure -> { response.throwable }
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:redditdemo="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@android:color/white"
tools:context="com.redditdemo.fragments.whatwedo.FragmentOverview">
<LinearLayout
public class BookmarkUpdateEventBus {
private PublishSubject<Void> subject = PublishSubject.create();
private static class InstanceHolder {
private static BookmarkUpdateEventBus instance = new BookmarkUpdateEventBus();
}
private BookmarkUpdateEventBus() {}
public class BigOhN3 {
private Integer[] result;
private long time;
BigOhN3(Integer[] list) {
long start = System.currentTimeMillis();
int coefficientSum = calculateCoefficient(list);
result = new Integer[list.length];