Skip to content

Instantly share code, notes, and snippets.

Daniel Gomez caipivara

  • La Haus
  • Medellin, Colombia
Block or report user

Report or block caipivara

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@caipivara
caipivara / jacoco.gradle
Created May 16, 2019
Android / Gradle - Jacoco gradle setup to join instrumentation and unit test coverage
View jacoco.gradle
// 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"
}
@caipivara
caipivara / add-spaces.sh
Created May 3, 2019
Add empty space recursively on each file for current folder
View add-spaces.sh
for f in $(find . -name '*.kt')
do
echo "" >> "$f"
done
@caipivara
caipivara / find_replace_all.sh
Created Dec 10, 2018
Bash - Replace all with find
View find_replace_all.sh
#!/bin/bash
find $1 -type f -exec sed -i "s/$2/$3/g" '{}' \;
@caipivara
caipivara / Observable+Extensions.swift
Created Jun 15, 2018
ios - how to add an extension to Observable and generics
View Observable+Extensions.swift
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
@caipivara
caipivara / TextViewExtensions.kt
Created Feb 26, 2018
Extension to set a text with HTML tags on TextView
View TextViewExtensions.kt
fun TextView.setHtmlText(text: String) {
val formattedText = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
Html.fromHtml(text, Html.FROM_HTML_MODE_LEGACY)
} else {
Html.fromHtml(text)
}
setText(formattedText, TextView.BufferType.SPANNABLE)
movementMethod = LinkMovementMethod.getInstance()
}
@caipivara
caipivara / gist:874cd2f7a923173415817136d761d3e8
Created Feb 17, 2018
[Kotlin, rxjava and room] - how to always get a value from Maybe
View gist:874cd2f7a923173415817136d761d3e8
class Optional<out M>(val data: M?)
@Dao
interface PatientDao {
@Query("SELECT * FROM $patientTableName LIMIT 1")
fun getFirst(): Maybe<User>
}
You can’t perform that action at this time.