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 kotlinx.coroutines.Deferred | |
suspend inline fun <T1, T2> awaitAll(t1: Deferred<T1>, t2: Deferred<T2>) = | |
kotlinx.coroutines.awaitAll(t1, t2).let { Pair<T1, T2>(it) } | |
suspend inline fun <T1, T2, T3> awaitAll(t1: Deferred<T1>, t2: Deferred<T2>, t3: Deferred<T3>) = | |
kotlinx.coroutines.awaitAll(t1, t2, t3).let { Triple<T1, T2, T3>(it) } | |
suspend inline fun <T1, T2, T3, T4> awaitAll(t1: Deferred<T1>, t2: Deferred<T2>, t3: Deferred<T3>, t4: Deferred<T4>) = | |
kotlinx.coroutines.awaitAll(t1, t2, t3, t4).let { Quadruple<T1, T2, T3, T4>(it) } |
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
/** | |
* Original parcelize plugin only applies to KotlinJvmAndroidCompilation, | |
* this copy extends support to the KotlinMultiplatformAndroidCompilation. | |
*/ | |
class NotParcelizeSubplugin : KotlinCompilerPluginSupportPlugin { | |
override fun apply(target: Project) = Unit | |
override fun isApplicable(kotlinCompilation: KotlinCompilation<*>) = | |
kotlinCompilation is KotlinJvmAndroidCompilation || kotlinCompilation is KotlinMultiplatformAndroidCompilation |
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
val ProjectDescriptor.descendants: Sequence<ProjectDescriptor> | |
get() = children.asSequence().flatMap { sequenceOf(it) + it.descendants } | |
gradle.settingsEvaluated { | |
rootProject.descendants.forEach { | |
// Given path - :tooling:idea-plugin OR :tooling-idea-plugin | |
val path = it.path | |
// after splitting - [tooling, idea, plugin] |
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
/** | |
# Please write a function that gets a text and tries to guess the possible languages of the text. | |
# | |
# Pangrams: Contains all the letters in an alpahabet of a language. | |
# | |
# English => The quick brown fox jumps over the lazy dog | |
# German => Zwölf Boxkämpfer jagen Viktor quer über den großen Sylter Deich | |
# Turkish => Pijamalı hasta yağız şoföre çabucak güvendi | |
# |
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
private class PagerAdapter extends android.support.v4.view.PagerAdapter { | |
// ... | |
private final Pattern patternBullet = Pattern.compile("[a-zA-Z0-9 ]+\\n"); | |
private final Pattern patternLine = Pattern.compile("~"); | |
private final String[] descriptions = new String[]{ | |
"Unlimited Albums\n~\n" + | |
"5 Customer Profiles\n~\n" + |
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.devone.haute.ui; | |
import android.app.ActivityManager; | |
import android.content.Context; | |
import android.content.DialogInterface; | |
import android.content.Intent; | |
import android.content.IntentFilter; | |
import android.graphics.Typeface; | |
import android.net.Uri; | |
import android.os.Build; |
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 HorizontalLineSpan extends ReplacementSpan { | |
private Context context; | |
public HorizontalLineSpan(Context context) { | |
this.context = context; | |
} | |
@Override |
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 LineDrawable extends Drawable { | |
private Context context; | |
private final Paint paint; | |
public LineDrawable(Context context) { | |
this.context = context; | |
paint = new Paint(); | |
paint.setStyle(Paint.Style.STROKE); |