Skip to content

Instantly share code, notes, and snippets.

View azlekov's full-sized avatar

Asen Lekov azlekov

View GitHub Profile
@azlekov
azlekov / PhoneNumberConsent.kt
Last active July 11, 2022 20:00
Jetpack Compose Phone Auth
@Composable
fun PhoneNumberConsent(
onPhoneNumberFetchedFromDevice: (phoneNumber: String) -> Unit,
) {
val context = LocalContext.current
val phoneNumberHintIntentResultLauncher =
rememberLauncherForActivityResult(ActivityResultContracts.StartIntentSenderForResult()) { result ->
try {
val phoneNumber = Identity.getSignInClient(context).getPhoneNumberFromIntent(result.data)
@azlekov
azlekov / platformio.ini
Created June 16, 2020 14:26
Adafruit Feather Express nRF52840 PlatformIO configuration for Black Magic Probe debugger
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
@azlekov
azlekov / ParseRecyclerViewAdapter.kt
Last active January 3, 2020 18:01
Parse Server RecyclerView Adapter with Data binding support
fun <T : ParseObject, VH : ViewDataBinding> RecyclerView.bind(
query: ParseQuery<T>,
@LayoutRes layout: Int = 0,
lifecycleOwner: LifecycleOwner
): ParseRecyclerAdapter<T, VH> {
val parseAdapter = ParseRecyclerAdapter<T, VH>(query, layout, lifecycleOwner)
layoutManager = LinearLayoutManager(context)
adapter = parseAdapter
return parseAdapter
}
@azlekov
azlekov / ParseExtensions.kt
Last active January 3, 2020 18:02
Provide synchronous style invocation of Parse queries using suspend function and Kotlin 1.3 Coroutines
import androidx.lifecycle.LiveData
import bolts.Task
import com.parse.ParseObject
import com.parse.ParseQuery
import kotlin.coroutines.resume
import kotlin.coroutines.resumeWithException
import kotlin.reflect.KProperty
import kotlinx.coroutines.*
suspend fun <T> Task<T>.await(): T {
@azlekov
azlekov / kml2polyline.py
Last active January 3, 2020 17:59
Convert KML coordinates of Placemark to polyline encoded format
#!/usr/bin/python
# pip install polyline
import polyline
def rreplace(s, old, new, count):
return (s[::-1].replace(old[::-1], new[::-1], count))[::-1]
@azlekov
azlekov / keybase.md
Last active September 19, 2017 20:44
Keybase.io

Keybase proof

I hereby claim:

  • I am l3k0v on github.
  • I am azlekov (https://keybase.io/azlekov) on keybase.
  • I have a public key ASCz1bZhx5gqIRErMD5xmv_KLen7H1Ie0nK6Q1vaA2lx1go

To claim this, I am signing this object: