Skip to content

Instantly share code, notes, and snippets.

View krzdabrowski's full-sized avatar

Krzysztof Dąbrowski krzdabrowski

View GitHub Profile
@micHar
micHar / annotatedStringResource.kt
Last active May 12, 2023 10:33
Helper function loading annotated strings from strings.xml (might require further optimization)
import android.text.Annotation
import android.text.SpannedString
import androidx.annotation.StringRes
import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.SpanStyle
import androidx.core.text.getSpans
@Composable
@gmk57
gmk57 / Sending events to UI.kt
Last active September 26, 2024 17:17
Sending events to UI with Channel/Flow + custom collector (see my first comment for reasons behind it)
/**
* Starts collecting a flow when the lifecycle is started, and **cancels** the collection on stop.
* This is different from `lifecycleScope.launchWhenStarted { flow.collect{...} }`, in which case
* the coroutine is just suspended on stop.
*/
inline fun <reified T> Flow<T>.collectWhileStarted(
lifecycleOwner: LifecycleOwner,
noinline action: suspend (T) -> Unit
) {
object : DefaultLifecycleObserver {
@FrankSpierings
FrankSpierings / README.MD
Last active September 30, 2024 14:05
Apple Device Enrollment Program (DEP) - ByPass MDM Policy using Checkra1n exploit

Pre-requirements

  • Install a socket daemon to multiplex connections from and to iOS devices, run: brew install usbmuxd
  • Start the socket daemon iproxy 2222 44
  • Install checkra1n exploit locally, run: brew install checkra1n
  • When SSH password authentication is requested, use: alpline.

Wipe iPad and restore Firmware

@wojteklu
wojteklu / clean_code.md
Last active October 15, 2024 13:13
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules