Skip to content

Instantly share code, notes, and snippets.

View igorwojda's full-sized avatar

Igor Wojda igorwojda

View GitHub Profile
@igorwojda
igorwojda / gist:2b5f4621cf55a23a7aa7f7fb1f2d4e9a
Last active October 21, 2017 13:32
Side effects - mutate argument
fun increatePatientAge(patient:Patient): Patient {
patient.age = patient.age++
return patient
}
fun sum (a:Int, b:Int): Int {
if(a > b) {
throw IllegalAccessException()
}
return a + b
}
@igorwojda
igorwojda / gist:e9ad6502bf7597f2094038592a6f4ce1
Created October 21, 2017 13:42
Side effects - calling other side effecting function
fun sumMe(a:Int): Int {
return sum(a, a)
}
fun sum (a:Int, b:Int): Int {
log.info("Added $a + $b")
return a + b
}
Observable.just(1)
.doOnNext { log.info("Next item emited: $it") }
.doOnError { log.error($it) }
.doOnComplete { log.info("Emission complete") }
buildTypes {
release {
ndk {
abiFilters "arm64-v8a", "armeabi-v7a"
}
}
android {
splits {
// Configures multiple APKs based on ABI.
abi {
// Enables building multiple APKs per ABI.
enable true
// By default all ABIs are included, so use reset() and include to specify that we only
// want APKs for x86, armeabi-v7a, and mips.
reset()
@igorwojda
igorwojda / gist:5b4e9348836dc2446c3fa07c838ed1b5
Last active August 29, 2020 07:59
Configure apk split for release builds
android {
splits {
abi {
def isReleaseBuild = false
gradle.startParameter.taskNames.find {
// Enable split for release builds in different build flavors
// (assemblePaidRelease, assembleFreeRelease, etc.).
if (it ==~ /:app:assemble.*Release/) {
isReleaseBuild = true
@igorwojda
igorwojda / gist:d2b2c3b9db7fe64bc3fb6228789c810d
Last active February 26, 2018 13:45
Configure apk split version codes
import com.android.build.OutputFile
android {
splits {
//...
}
// Map for the version code that gives each ABI a value.
def abiCodes = ['x86':1, 'x86_64':2, 'armeabi-v7a':3, 'arm64-v8a':4]
@igorwojda
igorwojda / gist:aa2bb39c103fe738bdaec9e4c1a80eac
Last active February 26, 2018 13:44
Apk split version codes
universal: 1, 2, 3
x86: 100001, 100002, 100003
x86_64: 200001, 200002, 200003
armeabi-v7a: 300001, 300002, 300003
arm64-v8a: 400001, 400002, 400003
class Person (var name:String, var lastName:String, var weight:Double)