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
package basics | |
fun main() { | |
val str ="no todos los carros son azules todos los carros son azules lo sabias sabias" | |
findRepeatedWords(str) | |
} | |
fun findRepeatedWords(str: String) { | |
val split = str.split(" ") | |
val map = mutableMapOf<String, Int>() |
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
package com.kavak.android.kavakops.modules.home.viewModel | |
import androidx.arch.core.executor.testing.InstantTaskExecutorRule | |
import com.kavak.android.content_data.repository.PostalCodesRepo | |
import com.kavak.android.content_domain.ColonyData | |
import com.kavak.android.content_usecases.zipCodesAndColonies.GetColoniesByPostalCodeUseCase | |
import com.kavak.android.kavakops.providers.SchedulerProvider | |
import com.kavak.android.kavakops.utils.LiveDataTestUtil | |
import io.reactivex.Single | |
import io.reactivex.observers.TestObserver |
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
abstract class BaseFullFragment: DialogFragment() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setStyle(STYLE_NORMAL, R.style.AppTheme) | |
} | |
override fun onCreateView( | |
inflater: LayoutInflater, container: ViewGroup?, | |
savedInstanceState: Bundle? |
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
class RemoteDataSourceImpl : RemoteDataSource { | |
private val db = FirebaseFirestore.getInstance().apply { | |
this.firestoreSettings = FirebaseFirestoreSettings | |
.Builder() | |
.setPersistenceEnabled(true) | |
.build() | |
} | |
companion object { |
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 md5(input:String): String { | |
val md = MessageDigest.getInstance("MD5") | |
return BigInteger(1, md.digest(input.toByteArray())).toString(16).padStart(32, '0') | |
} |
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
object Aes256 { | |
private fun cipher(operationMode: Int, secretKey: String = BuildConfig.KEY_ENCRYPT): Cipher { | |
if (secretKey.length != 32) throw RuntimeException("SecretKey length is not 32 chars") | |
val c = Cipher.getInstance("AES/CBC/PKCS5Padding") | |
val sk = SecretKeySpec(secretKey.toByteArray(Charsets.UTF_8), "AES") | |
val iv = IvParameterSpec(secretKey.substring(0, 16).toByteArray(Charsets.UTF_8)) | |
c.init(operationMode, sk, iv) | |
return c | |
} |
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
open class Event<out T>(private val content: T) { | |
var hasBeenHandled = false | |
private set // Allow external read but not write | |
/** | |
* Returns the content and prevents its use again. | |
*/ | |
fun getContentIfNotHandled(): T? { | |
return if (hasBeenHandled) { |
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
open class Event<out T>(private val content: T) { | |
var hasBeenHandled = false | |
private set // Allow external read but not write | |
/** | |
* Returns the content and prevents its use again. | |
*/ | |
fun getContentIfNotHandled(): T? { | |
return if (hasBeenHandled) { |
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
package com.google.android.gms.location.sample.locationupdates | |
import android.annotation.SuppressLint | |
import android.app.Application | |
import android.location.Location | |
import android.os.Looper | |
import android.util.Log | |
import androidx.appcompat.app.AppCompatActivity | |
import com.google.android.gms.location.* | |
import com.google.android.gms.tasks.OnCompleteListener |
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
sealed class BaseUiModel<out T> { | |
object Loading : BaseUiModel<Nothing>() | |
class Success<T>(val data: T) : BaseUiModel<T>() | |
class Error(val error: String) : BaseUiModel<Nothing>() | |
class ErrorEx(val data: Exception) : BaseUiModel<Nothing>() | |
} |
NewerOlder