Skip to content

Instantly share code, notes, and snippets.

@kellyfj
kellyfj / gist:cc915cefea08e95d64de338fe85e3976
Created September 29, 2016 16:31
Parallelizing a fixed number range of long running actions
//Parallelizing a fixed number range of long running actions
IntStream.range(0, NUM_OBJECTS_TO_CREATE).parallel().forEach(i -> {
//Your long running stuff goes here
});
@kellyfj
kellyfj / gist:702db34caa807a509c79
Last active April 25, 2019 14:55
To find and clean-up old Git remote branches that have been merged to master
#List all remote branches merged to master
git branch -r --merged
#For all old branches log last commit e.g.
git log --decorate -1 origin/Gauss
#To delete the branches you want
git push origin --delete Gauss
#For everyone to run locally to remove the remove references
@kellyfj
kellyfj / Gradle Android Jar Library
Last active November 8, 2019 20:33
Using the Android Library plugin for Gradle - create a .jar file (in addition to a .aar library file) that contains all the classes (and dependent jar files). Solution is based off a combination of solutions from https://gist.github.com/Lien/7150489 and the Winning answer to this Stackoverflow Question http://stackoverflow.com/questions/19307341…
android.libraryVariants.all { variant ->
def name = variant.buildType.name
if (name.equals(com.android.builder.BuilderConstants.DEBUG)) {
return; // Skip debug builds.
}
def task = project.tasks.create "jar${name.capitalize()}", Jar
task.dependsOn variant.javaCompile
//Include Java classes
task.from variant.javaCompile.destinationDir
//Include dependent jars with some exceptions