Skip to content

Instantly share code, notes, and snippets.

View mykhailo-gaidai's full-sized avatar

Mykhailo Gaidai mykhailo-gaidai

  • Viveo Health
  • Tallinn, Estonia
View GitHub Profile
@daschl
daschl / gist:db9fcc9d2b932115b679
Last active August 26, 2020 23:17
Draft: Writing Code for Production

Writing Resilient Reactive Applications

This guide is a first draft (that will end up in the official docs) on writing resilient code for production with the Couchbase Java SDK. At the end, the reader will be able to write code that withstands bugs, latency issues or anything else that can make their application fail.

Note that lots of concepts can be applied for both synchronous and asynchronous access. When necessary, both patterns are discussed separately. Also, the focus is on database interaction, but if you are using RxJava as part of your stack you can apply most of the principles there as well (and should!).

RxJava 101 Recap: Cold and Hot Observables

When working with Observables, it is important to understand the difference between cold and hot. Cold Observables will start to emit events once a Observer subscribes, and will do it "fresh" for each Observer. Hot Observables instead are starting to emit data as soon as it becomes available, and will return the same (or parts of the same)

@saadfarooq
saadfarooq / android_replace_in_manifest.gradle
Last active March 1, 2024 15:47
Gradle function to replace a placeholder string in AndroidManifest.xml with productFlavor package name
replaceInManifest = {variant, fromString, toString ->
def flavor = variant.productFlavors.get(0)
def buildtype = variant.buildType
def manifestFile = "$buildDir/manifests/${flavor.name}/${buildtype.name}/AndroidManifest.xml"
def updatedContent = new File(manifestFile).getText('UTF-8').replaceAll(fromString, toString)
new File(manifestFile).write(updatedContent, 'UTF-8')
}