Skip to content

Instantly share code, notes, and snippets.

@objcode
objcode / ConcurrencyHelpers.kt
Last active January 15, 2024 05:17
Helpers to control concurrency for one shot requests using Kotlin coroutines.
/* Copyright 2019 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@vestrel00
vestrel00 / Dagger2SimpleExample.java
Last active October 7, 2021 19:59
A: Dagger.android 2.11 simple example with support for Singleton, PerActivity, PerFragment, and PerChildFragment scopes
// This is a super simplified example of how to use the new dagger.android framework
// introduced in Dagger 2.10. For a more complete, in-depth guide to dagger.android
// read https://proandroiddev.com/how-to-android-dagger-2-10-2-11-butterknife-mvp-part-1-eb0f6b970fd
// For a complete codebase using dagger.android 2.11-2.17, butterknife 8.7-8.8, and MVP,
// see https://github.com/vestrel00/android-dagger-butterknife-mvp
// This example works with Dagger 2.11-2.17. Starting with Dagger 2.11,
// @ContributesAndroidInjector was introduced removing the need to define @Subcomponent classes.
@wojteklu
wojteklu / clean_code.md
Last active April 26, 2024 05:52
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