Skip to content

Instantly share code, notes, and snippets.

Yury Polek y-polek

Block or report user

Report or block y-polek

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
@y-polek
y-polek / doze_mode_adb_commands.sh
Last active Jan 9, 2020
adb commands to test Doze mode
View doze_mode_adb_commands.sh
#! /bin/zsh
# Buttery powered state
adb shell dumpsys battery | grep powered
# Unplug battery
adb shell dumpsys battery unplug
# Reset battery
adb shell dumpsys battery reset
@y-polek
y-polek / LiveDataExt.kt
Last active Jan 8, 2020
'map' and 'combineLatest' transformations for LiveData
View LiveDataExt.kt
import android.arch.lifecycle.LiveData
import android.arch.lifecycle.MediatorLiveData
import android.arch.lifecycle.MutableLiveData
fun <X, Y> LiveData<X>.map(func: (X?) -> Y?): MutableLiveData<Y?> {
return MediatorLiveData<Y>().apply {
addSource(this@map) { x -> value = func(x) }
}
}
@y-polek
y-polek / build.gradle
Last active Jun 21, 2018
Gradle: Read property from file
View build.gradle
/**
* Read property with {@code propertyName} from file with {@code fileName}.
* <p>
* Example of property file content:<br>
* api_key=5c7f743fe85eae73489af35c1a387a05
* apiSecret=12345678910
*
* @return Value of specified property.
* @throws GradleException if file not found or there is no specified property in a file.
*/
You can’t perform that action at this time.