Skip to content

Instantly share code, notes, and snippets.

View danielgomezrico's full-sized avatar

Daniel Gomez danielgomezrico

View GitHub Profile
@danielgomezrico
danielgomezrico / jacoco.gradle
Last active February 15, 2023 09:41
Jacoco setup to merge coverage for android when you run unit tests + integration tests and get a mixed result
// Merge of
// https://github.com/mgouline/android-samples/blob/master/jacoco/app/build.gradle
// and https://github.com/pushtorefresh/storio/blob/master/gradle/jacoco-android.gradle
// Requires Jacoco plugin in build classpath.
apply plugin: 'jacoco'
jacoco {
toolVersion = "0.8.3"
}
@danielgomezrico
danielgomezrico / gist:cbd98365a840a93c4e6a04e25b2b1671
Last active October 9, 2019 13:38
Android - How to transform from List<T> to Observable<PageList<T>> for androidx paging library
package com.lahaus.utils.extensions
import androidx.paging.DataSource
import androidx.paging.PagedList
import androidx.paging.PositionalDataSource
import androidx.paging.RxPagedListBuilder
import io.reactivex.Observable
fun <T> List<T>.toObservablePagedList(): Observable<PagedList<T>> {
val defaultConfig = PagedList.Config.Builder()
@danielgomezrico
danielgomezrico / jacoco.gradle
Created May 16, 2019 16:15
Android / Gradle - Jacoco gradle setup to join instrumentation and unit test coverage
// Merge of
// https://github.com/mgouline/android-samples/blob/master/jacoco/app/build.gradle
// and https://github.com/pushtorefresh/storio/blob/master/gradle/jacoco-android.gradle
// Requires Jacoco plugin in build classpath.
apply plugin: 'jacoco'
jacoco {
toolVersion = "0.8.3"
}
@danielgomezrico
danielgomezrico / add-spaces.sh
Created May 3, 2019 15:26
Add empty space recursively on each file for current folder
for f in $(find . -name '*.kt')
do
echo "" >> "$f"
done
@danielgomezrico
danielgomezrico / find_replace_all.sh
Created December 10, 2018 16:53
Bash - Replace all with find
#!/bin/bash
find $1 -type f -exec sed -i "s/$2/$3/g" '{}' \;
@danielgomezrico
danielgomezrico / phoronix-cmd.md
Created November 27, 2018 16:11 — forked from anshula/phoronix-cmd.md
Phoronix Test Suite Cheat Sheet
@danielgomezrico
danielgomezrico / Observable+Extensions.swift
Created June 15, 2018 12:24
ios - how to add an extension to Observable and generics
import Foundation
import RxSwift
import RxCocoa
extension ObservableType where E == String {
/// Limit the max size of the string that's been emitted
func limit(maxStringSize: Int) -> RxSwift.Observable<String> {
return scan("") { (previous, new) -> String in
return new.count <= maxStringSize ? new : previous