Skip to content

Instantly share code, notes, and snippets.

View PaulWoitaschek's full-sized avatar

Paul Woitaschek PaulWoitaschek

View GitHub Profile
View android_build_bisect.main.kts
#!/usr/bin/env kotlin
@file:DependsOn("com.github.ajalt.clikt:clikt-jvm:3.5.2")
@file:OptIn(ExperimentalTime::class)
import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.parameters.options.option
import com.github.ajalt.clikt.parameters.options.required
import java.io.File
import java.security.MessageDigest
import kotlin.time.ExperimentalTime
View EnumGenerator.kt
internal class EnumGenerator(
private val codeGenerator: CodeGenerator
) {
fun generate(classDeclaration: KSClassDeclaration) {
require(classDeclaration.classKind == ClassKind.ENUM_CLASS) {
"${classDeclaration.containingFile?.filePath} is no enum."
}
val enum = buildEnum(classDeclaration)
View SwiftGenProcessor.kt
internal class SwiftGenProcessor(
private val environment: SymbolProcessorEnvironment
) : SymbolProcessor {
private var invoked = false
override fun process(resolver: Resolver): List<KSAnnotated> {
if (invoked) {
return emptyList()
}
View kill-daemons.main.kts
#!/usr/bin/env kotlin
@file:DependsOn("com.github.ajalt.clikt:clikt-jvm:3.0.1")
import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.core.UsageError
import com.github.ajalt.clikt.output.TermUi
class App : CliktCommand() {
enum class DaemonType {
View transition-outline.kt
package com.example.outlinetransition
import android.graphics.Color
import android.graphics.Outline
import android.os.Bundle
import android.view.View
import android.view.ViewOutlineProvider
import android.widget.FrameLayout
import androidx.annotation.ColorInt
import androidx.annotation.Px
View StupidLintRule.kt
import com.android.tools.lint.client.api.UElementHandler
import com.android.tools.lint.detector.api.Category
import com.android.tools.lint.detector.api.Detector
import com.android.tools.lint.detector.api.Implementation
import com.android.tools.lint.detector.api.Issue
import com.android.tools.lint.detector.api.JavaContext
import com.android.tools.lint.detector.api.Scope
import com.android.tools.lint.detector.api.Severity
import com.android.tools.lint.detector.api.SourceCodeScanner
import org.jetbrains.uast.UClass
@PaulWoitaschek
PaulWoitaschek / .gitconfig
Created May 31, 2018 08:53
Git Daily Report
View .gitconfig
# git report 2018-05-31
[alias]
report = "!f() { git log --after=\""$1" 00:00\" --before=\""$1" 23:59\" --pretty=format:\"* %s\" --reverse; }; f"
@PaulWoitaschek
PaulWoitaschek / Repo.kt
Last active December 27, 2017 18:18
Reactive Repository
View Repo.kt
class Repo<in Key : Any, Value : Any>(
private val dataSource: DataSource<Key, Value>,
private val persister: Persister<Key, Value>
) {
private val cleared = PublishSubject.create<Key>()
private val cache = HashMap<Key, Flowable<Value>>()
fun stream(key: Key): Flowable<Value> =
cache.getOrPut(key) { newStream(key) }
@PaulWoitaschek
PaulWoitaschek / layout.xml
Created October 13, 2017 08:10
CL Bug 1.1.0-beta3
View layout.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<View
android:id="@+id/red"
android:layout_width="0dp"