Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Cafer Mert Ceyhan mertceyhan

🎯
Focusing
View GitHub Profile
@mertceyhan
mertceyhan / BubbleSort.kt
Created Jan 13, 2022
Bubble Sort in Kotlin
View BubbleSort.kt
object BubbleSort {
fun sort(array: Array<Int>) {
for (i in array.indices) {
for (j in 0 until array.size - i - 1) {
if (array[j] > array[j + 1]) {
swap(array, firstIndex = j, secondIndex = j + 1)
}
}
}
@mertceyhan
mertceyhan / build.gradle.kts
Last active Nov 5, 2021
A logger for Gradle local unit test runner command
View build.gradle.kts
// Project level build.gradle file
subprojects {
tasks.withType(Test::class.java) {
testLogging {
showCauses = false
showExceptions = false
showStackTraces = false
showStandardStreams = false
View OnOneOffClickListener.kt
abstract class OnOneOffClickListener(private var defaultInterval: Int,
private val onOneClick: (View) -> Unit) : View.OnClickListener {
private var lastTimeClicked: Long = 0
override fun onClick(view: View) {
if ((SystemClock.elapsedRealtime() - lastTimeClicked) >= (defaultInterval)) {
lastTimeClicked = SystemClock.elapsedRealtime()
onOneClick(view)
}
@mertceyhan
mertceyhan / RSAEncryptionHelper.kt
Last active Apr 27, 2020
This class helps to you for in RSA encryption and decryption operation in Kotlin.
View RSAEncryptionHelper.kt
import android.util.Base64
import java.security.KeyFactory
import java.security.PrivateKey
import java.security.PublicKey
import java.security.spec.PKCS8EncodedKeySpec
import java.security.spec.X509EncodedKeySpec
import javax.crypto.Cipher
/**
*