Skip to content

Instantly share code, notes, and snippets.

List the technology stack of Android and iOS in a widely topics (from development tools, language, async handling, state handling, unit testing framework, UI testing framework, nework framework, deployment tools, DI framework, architecture, local data handling, modulariation, ci/cd, push notification framework, oauth framework, crashlytics framework, logging framework, product flavors solution).
For example, topic "UI development", Android use Jetpack compose UI, ios use swiftUI, topic "Development tool", Android use ANdroid studio, iOS use XCode in a table.
@li2
li2 / gist:f32b90da96e6c1dba1c1e2221c295904
Created January 9, 2024 22:55
Ktor headers case-insensitive, set append
headers {
set("header-abc", "abc")
set("header-ABC", "ABC")
append("header-xyz", "xyz")
append("header-XYZ", "XYZ")
}
2024-01-10 11:53:39.983 [outine#6] INFO io.ktor.client.HttpClient
- REQUEST: https://ktor.io/docs/welcome.html
METHOD: HttpMethod(value=GET)
@li2
li2 / MyAndroidApplication.kt
Created August 20, 2023 22:46 — forked from sebaslogen/MyAndroidApplication.kt
Finish all opened activities in my Android app (also across different tasks)
class MainApplication : Application() {
private val createdActivities = mutableListOf<WeakReference<Activity>>()
override fun onCreate() {
super.onCreate()
registerActivityLifecycleCallbacks(activityLifecycleCallbacks())
}
fun closeAllActivities() {
@li2
li2 / README.md
Last active March 28, 2024 06:57
Rfw demo

dart run encode.dart alert.rfwtxt alert.rfw

@li2
li2 / aws-iot-provisioning-mvn-command.sh
Created May 14, 2021 11:08
AWS IoT FleetProvisioningSample mvn command
mvn exec:java -Dexec.mainClass="identity.FleetProvisioningSample" \
-Dexec.args="--endpoint {yourEndpoint}.iot.ap-southeast-2.amazonaws.com \
--rootca {yourRootCaPath}.pem \
--cert {yourCertPath}.pem.crt \
--key {yourPrivateKeyPath}.pem.key \
--templateName {yourTemplateName}
--templateParameters {\"serialNumber\":Mac21}" -e -X
@li2
li2 / Android Privacy Policy
Last active June 13, 2020 06:47 — forked from alphamu/Android Privacy Policy Template
Privacy policy for Android apps
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width'>
<title>Privacy Policy</title>
<style> body { font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; padding:1em; } </style>
</head>
<body>
<strong>Privacy Policy</strong> <p>
/**
* Return query text changes observable.
*
* - filter: to filter undesired text like blank text to avoid unnecessary API call.
* - debounce: to ignore the previous items in the given time and only emit the last one, to avoid too much API calls.
* - distinctUntilChanged: to avoid the duplicate API call.
*/
fun EditText.queryTextChanges(): Observable<String> {
return textChanges()
.map { it.toString() }
import org.junit.Assert.*
import org.junit.Before
import org.junit.Test
class ViewTest {
private lateinit var firstColour: Colour
private lateinit var secondColour: Colour
private lateinit var overlappedColour: Colour
import kotlin.math.roundToInt
/**
* Colour in RGB, with each value between 0 – 255 (e.g. R=255, G=0, B=0 would imply a red chart)
*
* @throws IllegalArgumentException if one of the parameters [r], [g] and [b] is out of bound [0, 255]
*/
data class Colour(val r: Int, val g: Int, val b: Int) {
init {
if (r !in QUALIFIED_RANGE || g !in QUALIFIED_RANGE || b !in QUALIFIED_RANGE)
@li2
li2 / BluetoothCallback.java
Created October 29, 2018 02:39 — forked from joinAero/BluetoothCallback.java
Android - The bluetooth listener and profile proxy.
package cc.cubone.turbo.core.bluetooth;
/**
* Interface definition for a callback to be invoked when bluetooth state changed.
*/
public interface BluetoothCallback {
/**
* Called when the bluetooth is off.
*/