Skip to content

Instantly share code, notes, and snippets.

void main() {
Carro c1 = Carro("Fusca");
c1.acelerar(50);
c1.abastecer(50);
}
class Carro extends Automovel with Combustivel {
String nome;
Carro(this.nome);
apply plugin: 'org.sonarqube'
afterEvaluate {
def flavor = "DEV"
def variant = "devDebug"
def testTaskName = "test${variant.capitalize()}UnitTest"
def junitReportsPath = "build/outputs/androidTest-results/connected/flavors/$flavor/"
def ecFileName = ""
project.tasks[testTaskName].reports.junitXml.destination = junitReportsPath
apply plugin: 'jacoco'
jacoco {
toolVersion = '0.8.2'
}
tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
}
inline fun <reified T : Any> zipLiveData(vararg liveItems: LiveData<*>): LiveData<List<T>> {
return MediatorLiveData<List<T>>().apply {
val zippedObjects = mutableListOf<T>()
liveItems.forEach {
addSource(it, { item ->
zippedObjects.add(item as T)
if (zippedObjects.size == liveItems.size)
value = zippedObjects
})
}
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
object TimeUtils {
fun millisToShortDHMS(duration: Long): String {
var res = "" // java.util.concurrent.TimeUnit;
val days = TimeUnit.MILLISECONDS.toDays(duration)
val hours = TimeUnit.MILLISECONDS.toHours(duration) - TimeUnit.DAYS.toHours(TimeUnit.MILLISECONDS.toDays(duration))
val minutes = TimeUnit.MILLISECONDS.toMinutes(duration) - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(duration))
val seconds = TimeUnit.MILLISECONDS.toSeconds(duration) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(duration))
val millis = TimeUnit.MILLISECONDS.toMillis(duration) - TimeUnit.SECONDS.toMillis(TimeUnit.MILLISECONDS.toSeconds(duration))
@hernandazevedo
hernandazevedo / .bashrc
Created December 26, 2017 12:01 — forked from ricalo/.bashrc
Use git-bash from Android Studio terminal
if [ ! -z "${IDE}" -a "${IDE}" == "AndroidStudio" ]; then
cd $OLDPWD;
fi
@hernandazevedo
hernandazevedo / gradle.properties
Last active December 17, 2017 22:07
put this file at the folder ~user/.gradle to avoid infinite build, and use offline cache
org.gradle.daemon = true
org.gradle.parallel = true
org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8org.gradle.daemon = true