Skip to content

Instantly share code, notes, and snippets.

View anthonymonori's full-sized avatar

Antal Monori anthonymonori

View GitHub Profile
@anthonymonori
anthonymonori / captureFingerprints.gradle.kts
Last active December 21, 2022 16:26 — forked from ghale/captureFingerprints.gradle
Capture task classpath fingerprints with Gradle Kotlin DSL
// Add into root project, make sure you have Gradle Enterprise plugin
val buildScanApi = project.extensions.findByName("buildScan") as BuildScanExtension
subprojects {
// If you want to limit it to certain module(s), wrap it with: if (name == "module-name") { }
val fingerprinter = serviceOf<org.gradle.internal.fingerprint.classpath.ClasspathFingerprinter>()
tasks.withType(org.jetbrains.kotlin.gradle.dsl.KotlinCompile::class.java).configureEach task@{
doFirst {
var classLoader: ClassLoader = this@task.javaClass.classLoader
while (classLoader is java.net.URLClassLoader) {
val fingerprints = mutableSetOf<Array<String>>()
@anthonymonori
anthonymonori / mockk-suspend-operator-overload-issue.md
Created June 4, 2021 14:12
Example workaround for suspend operator overloading in Kotlin when using MockK testing library

The problem

Let's consider the following code:

class UseCase() {
    suspend operator fun invoke(param1: String) = Unit
}
@anthonymonori
anthonymonori / time-and-space-complexity.txt
Created October 4, 2015 10:34
Big Oh notation and everything you need to know about it - perfect for tech interview preparation!
Common Running Time
There are some common running times when analyzing an algorithm:
O(1) – Constant Time Constant time means the running time is constant, it’s not affected by the input size.
O(n) – Linear Time When an algorithm accepts n input size, it would perform n operations as well.
O(log n) – Logarithmic Time Algorithm that has running time O(log n) is slight faster than O(n). Commonly, algorithm divides the problem into sub problems with the same size. Example: binary search algorithm, binary conversion algorithm.