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 / 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 ( == 'preFlavorDevelopDebugBuild') {
task.dependsOn copyFiles
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 / 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()
return crc.value
StuStirling /
Last active Apr 12, 2017
RxJava Simple Explanations

RxJava Simplified



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.


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.