Skip to content

Instantly share code, notes, and snippets.

View ChristopherME's full-sized avatar

Christopher Elias ChristopherME

View GitHub Profile
@ChristopherME
ChristopherME / recyclerview-fix-leak-extension.kt
Last active March 25, 2023 14:05
This extension method is a solution for a memory leak problem with recyclerviews.
/**
* Set the adapter and call [clearReference] extension function in one call.
* Use this extension if the current Fragment is going to be REPLACED. (When using fragmentTransaction.add is not necessary) the back stack.
*/
fun <VH : RecyclerView.ViewHolder> RecyclerView.setNullableAdapter(
adapter: RecyclerView.Adapter<VH>
) {
this.adapter = adapter
this.clearReference()
@DevPicon
DevPicon / FlowExample.kt
Created January 9, 2021 19:36
StateFlow and Sharedflow... the end of LiveData?
package sharedflow.macao.flow
import flow.others.log
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import kotlin.random.Random
@bryanbraun
bryanbraun / git-branching-diagram.md
Last active October 27, 2024 18:03
Example Git Branching Diagram

Example Git Branching Diagram

You can use this diagram as a template to create your own git branching diagrams. Here's how:

  1. Create a new diagram with diagrams.net (formerly draw.io)
  2. Go to File > Open From > URL
  3. Insert this url (it points to the xml data below): https://gist.githubusercontent.com/bryanbraun/8c93e154a93a08794291df1fcdce6918/raw/bf563eb36c3623bb9e7e1faae349c5da802f9fed/template-data.xml
  4. Customize as needed for your team.

@jemshit
jemshit / AndroidResourceProvider.kt
Last active May 10, 2022 16:34
Android Resource Provider for Presenter in MVP
import android.content.Context
import android.support.annotation.*
import android.support.v4.content.ContextCompat
import interface_adapters.ResourceProvider
import javax.inject.Inject
import javax.inject.Named
import javax.inject.Singleton
@Singleton
class AndroidResourceProvider
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
@parmentf
parmentf / GitCommitEmoji.md
Last active November 20, 2024 16:29
Git Commit message Emoji