Skip to content

Instantly share code, notes, and snippets.

Stu Stirling StuStirling

Block or report user

Report or block StuStirling

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
@StuStirling
StuStirling / prebuild.gradle
Created Apr 24, 2018
Android Prebuild Task
View prebuild.gradle
task copyFiles(type: Copy) {
from "$projectDir/src/flavorDevelop/cpp/"
into "$projectDir/src/develop/cpp/"
}
tasks.whenTaskAdded { task ->
if (task.name == 'preFlavorDevelopDebugBuild') {
task.dependsOn copyFiles
}
}
@StuStirling
StuStirling / versioning.gradle
Last active Mar 3, 2018
Using GIT to Version the Android App
View versioning.gradle
def getVersionName = { ->
try {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--match', "dev/[0-9]*.[0-9]*.[0-9]*", "--abbrev=0", 'HEAD'
standardOutput = stdout
}
return stdout.toString().replace("version/","").trim()
}
catch (ignored) {
@StuStirling
StuStirling / File.kt
Created Jul 20, 2017
Some useful File extensions
View File.kt
/**
* Generates a checksum for a file.
*/
fun File.checksum() : Long? {
val crc = CRC32()
crc.update(readBytes())
return crc.value
}
@StuStirling
StuStirling / RxJava-Simplified.md
Last active Apr 12, 2017
RxJava Simple Explanations
View RxJava-Simplified.md

RxJava Simplified

Operators

SwitchMap

Similar to flatMap in that it takes one Observable and returns another. However, the difference is, if the original source Observable emits a new item, then the Observable returned by the switchMap operator will stop what it's currently emitting and focus on the latest source Observable emission.

This StackOverflow answer explans it well, with both flatMap and switchMap marble diagrams next to each other.

View AndroidCheatSheet.md

Android Cheat Sheet

Just some code fragments that I find useful. This will be updated as I go.

You can’t perform that action at this time.