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 kotlin.properties.ReadOnlyProperty | |
| import kotlin.properties.ReadWriteProperty | |
| import kotlin.reflect.KProperty | |
| private typealias GetValue<This, R> = (thisRef: This, property: KProperty<*>) -> R | |
| private typealias SetValue<This, R> = (thisRef: This, property: KProperty<*>, value: R) -> Unit | |
| inline fun <This, R> property( | |
| crossinline getValue: GetValue<This, R> | |
| ) = |
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 sample: (X, Y, Z) -> Int = multiReceiver { { { x + y + z } } } | |
| fun <A, B, C, R> multiReceiver(f: A.() -> B.() -> C.() -> R) = { a: A, b: B, c: C -> f(a)(b)(c) } | |
| class X(val x: Int) | |
| class Y(val y: Int) | |
| class Z(val z: Int) |
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
| // ...stuff... | |
| tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> { | |
| kotlinOptions { | |
| freeCompilerArgs = listOf( | |
| "-Xnew-inference", | |
| "-Xallow-kotlin-package" | |
| ) | |
| } | |
| } |
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
| // adapted from https://github.com/JetBrains/kotlin/blob/0103c0d2fd8c9ae9e7f41898064407a6278c5831/j2k/tests/org/jetbrains/kotlin/j2k/AbstractJavaToKotlinConverterForWebDemoTest.kt | |
| package me.eugeniomarletti | |
| import com.intellij.codeInsight.ContainerProvider | |
| import com.intellij.codeInsight.NullabilityAnnotationInfo | |
| import com.intellij.codeInsight.NullableNotNullManager | |
| import com.intellij.codeInsight.runner.JavaMainMethodProvider | |
| import com.intellij.core.CoreApplicationEnvironment | |
| import com.intellij.core.JavaCoreApplicationEnvironment |
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
| def buildConfigAndResStringField(variant, name, value) { | |
| variant.resValue 'string', name.toLowerCase(), value | |
| variant.buildConfigField 'String', name, "\"$value\"" | |
| } | |
| afterEvaluate { | |
| android.applicationVariants.all { variant -> | |
| variant.resValue 'string', 'application_id', variant.applicationId | |
| buildConfigAndResStringField variant, "ACCOUNT_TYPE", variant.applicationId | |
| buildConfigAndResStringField variant, "CONTENT_AUTHORITY", variant.applicationId + ".provider" |
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
| @file:Suppress("NonAsciiCharacters") | |
| package me.eugeniomarletti.util.destructuring.pair.nested | |
| object NoDestructuring | |
| typealias PairA<A> = Pair<A, *> | |
| typealias PairB<B> = Pair<*, B> | |
| //region nesting level: 1 |
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
| // animated GIF: https://i.stack.imgur.com/mHOIc.gif | |
| // see https://stackoverflow.com/a/46244263/1306903 | |
| import 'package:flutter/material.dart'; | |
| import 'ink_text_selection_layout.dart'; | |
| class Demo extends StatelessWidget { | |
| @override | |
| Widget build(context) => inkTextSelectionLayout( |
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
| /** | |
| * ArcUtils.java | |
| * | |
| * Copyright (c) 2014 BioWink GmbH. | |
| * | |
| * Permission is hereby granted, free of charge, to any person obtaining a copy | |
| * of this software and associated documentation files (the "Software"), to deal | |
| * in the Software without restriction, including without limitation the rights | |
| * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| * copies of the Software, and to permit persons to whom the Software is |
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
| @file:Suppress("PackageDirectoryMismatch") // root package looks great when importing, ie. `import exhaustive` | |
| /** | |
| * Allows requiring an exhaustive mapping in a `when` block when used with the [rangeTo] operator. | |
| * @sample [exhaustive_when_example] | |
| */ | |
| @Suppress("ClassName") // lowercase because it should look like a keyword | |
| object exhaustive { |
NewerOlder