Skip to content

Instantly share code, notes, and snippets.

View azlekov's full-sized avatar

Asen Lekov azlekov

  • Digital Lights Ltd.
  • Sofia, Bulgaria
  • 11:25 (UTC +03:00)
  • X @azlekov
View GitHub Profile
@azlekov
azlekov / supabase.yaml
Last active October 17, 2024 12:42
Run Supabase instance on Coolify installed on Raspberry Pi 5
# documentation: https://supabase.io
# slogan: The open source Firebase alternative.
# tags: firebase, alternative, open-source
# minversion: 4.0.0-beta.228
# logo: svgs/supabase.svg
# port: 8000
services:
supabase-kong:
image: kong:2.8.1
@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]