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 org.json.JSONObject | |
typealias JsonObserver = (jsonObject: JSONObject) -> Unit | |
class JSONSubject { | |
companion object { | |
fun instance() = JSONSubject() | |
} |
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
Generating SHA256 hash of public key from a certificate (mycertfile.pem) | |
openssl x509 -in mycertfile.pem -pubkey -noout | openssl rsa -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64 |
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
fun main() { | |
val fun1: (Int) -> Int = { x -> x + 1 } | |
val fun2: (String) -> String = { x -> x.reversed() } | |
val fun3: (List<Int>) -> Int = { x -> x.sum() } | |
val fun4: (Double) -> Double = { x -> x * x } | |
val result1: (Int) -> Any = ::fun4::fun3::fun2::fun1 | |
val result2: (Int) -> Any = fun4::fun3::fun2::fun1 | |
val fun5: (Any) -> String = { x -> x.toString() } |
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 androidx.compose.foundation.layout.Column | |
import androidx.compose.foundation.layout.fillMaxWidth | |
import androidx.compose.runtime.* | |
import androidx.compose.ui.Modifier | |
import androidx.compose.ui.draw.drawBehind | |
import androidx.compose.ui.graphics.Color | |
import androidx.compose.ui.graphics.Path | |
import androidx.compose.ui.graphics.drawscope.Stroke | |
import androidx.compose.ui.layout.onGloballyPositioned | |
import androidx.compose.ui.unit.dp |
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.* | |
fun main() { | |
println("Analyzing algorithms...") | |
val array = IntArray(1000000) { Random().nextInt() } | |
analyseAlgorithms("quikSort" , { quikSort(it) }, array) | |
analyseAlgorithms("mergeSort" , { mergesort(it) }, array) |
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
interface AppUpdater { | |
fun checkUpdate() | |
} | |
class AppUpdaterImpl(val activity: AppCompatActivity) : AppUpdater { | |
companion object { | |
private const val APP_UPDATE_REQUEST_CODE = 1991 |