Skip to content

Instantly share code, notes, and snippets.

View G00fY2's full-sized avatar

Thomas Wirth G00fY2

View GitHub Profile
@G00fY2
G00fY2 / gist:c8daab6115c07d78d8851565bf703375
Created April 14, 2021 22:25
kotlin conventional commit
val conventionalCommitRegex = Regex("^((build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\\(\\w+\\))?(!)?(: (.*\\s*)*))|(Merge (.*\\s*)*)|(Initial commit\$)")
val maxSubjectLineLength = 72
val test = "fix(dagger): fix bad injection"
conventionalCommitRegex.matches(test) && test.lines().first().length <= maxSubjectLineLength
org.gradle.jvmargs=-Xmx3g -XX:+UseParallelGC
org.gradle.daemon=true
org.gradle.caching=true
org.gradle.parallel=true
org.gradle.configureondemand=false
org.gradle.vfs.watch=true
@G00fY2
G00fY2 / gist:ce88eb2dc2ee68f25b4a292571321f97
Created November 16, 2020 21:25
Android DeviceDefault AccentColor
var accentColor = Color.WHITE
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.Q) {
context.obtainStyledAttributes(
android.R.style.ThemeOverlay_DeviceDefault_Accent_DayNight,
intArrayOf(android.R.attr.colorAccent)
).also {
accentColor = it.getColor(0, accentColor)
}.recycle()
}
@G00fY2
G00fY2 / .gitignore
Last active July 3, 2021 11:33
A current reference template to use for Android development collected from the official github and gitignore.io templates. The template contains OS specific files (macOS, Linux, Windows) as well as files regarding the IDE (IntelliJ IDEA/Android Studio), Gradle, Java, Kotlin, proguard, build artifacts, common plugins and many more.
# Reference gitignore https://gist.github.com/G00fY2/81c0aa67943cca021e915840bf73ee1b
# Built application files
*.apk
*.aar
*.ap_
*.aab
# Files for the ART/Dalvik VM
*.dex
@G00fY2
G00fY2 / CustomRxJava2CallAdapterFactory.java
Last active October 2, 2024 04:13
CustomRxJava2CallAdapterFactory to transform HttpExceptions to custom error
import com.google.gson.Gson;
import io.reactivex.Completable;
import io.reactivex.Flowable;
import io.reactivex.Maybe;
import io.reactivex.MaybeSource;
import io.reactivex.Observable;
import io.reactivex.ObservableSource;
import io.reactivex.Scheduler;
import io.reactivex.Single;
import java.lang.annotation.Annotation;
@G00fY2
G00fY2 / privacy_policy_template.md
Last active December 14, 2020 07:42
Basic privacy policy template for open source apps that do not collect any personal information

Privacy Policy

[author] built the app [app_name] as an open source app for use as is.

Your Privacy

I take your privacy seriously! That's why this app does NOT collect or share any personal information.

The app also does NOT use third party services that collect information used to identify you.

@G00fY2
G00fY2 / CircleTransformation.kt
Last active March 10, 2020 01:48
Circle image transformation for Picasso 3 which handles API 26+ hardware bitmaps
import android.graphics.Bitmap
import android.graphics.Bitmap.Config
import android.graphics.BitmapShader
import android.graphics.Canvas
import android.graphics.Paint
import android.graphics.Shader
import android.os.Build.VERSION
import android.os.Build.VERSION_CODES
import com.squareup.picasso3.RequestHandler
import com.squareup.picasso3.Transformation