Skip to content

Instantly share code, notes, and snippets.

View tevjef's full-sized avatar
🤷‍♂️
I'm on it

Tevin tevjef

🤷‍♂️
I'm on it
View GitHub Profile
@tevjef
tevjef / ProguardMappingMapperTask.kt
Last active October 25, 2022 20:47
Strips mappings from proguard file
package com.mycompany.gradle.tasks
import org.gradle.api.DefaultTask
import org.gradle.api.GradleException
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.Optional
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.TaskAction
import java.io.File
@tevjef
tevjef / build.gradle
Created May 5, 2019 21:39
How to use a dev version of kotlin
buildscript {
ext.kotlin_version = '1.3.40-dev-2527'
repositories {
maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' }
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
@Navigator.Name("controller")
class ControllerNavigator(private val router: Router) : Navigator<Destination>() {
override fun createDestination() = Destination(this)
override fun popBackStack() = false /* Not yet implemented */
override fun navigate(destination: Destination, args: Bundle?, navOptions: NavOptions?) {
/* Not yet implemented */
}
class NavHostLayout
@JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0):
FrameLayout(context, attrs, defStyleAttr), NavHost {
init {
...
/* 1 */ navigationController = NavController(context)
/* 2 */ Navigation.setViewNavController(this, navigationController)
/* 3 */ val navigator = createControllerNavigator()
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<com.prolificinteractive.NavHostLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:navGraph="@navigation/graph"
/>
<navigation app:startDestination="@+id/firstController">
<controller
android:id="@+id/firstController"
android:name="com.prolificinteractive.DemoController"
android:label="MyController">
</controller>
</navigation>
@tevjef
tevjef / dependency-report.gradle
Created February 11, 2018 01:04 — forked from tzachz/dependency-report.gradle
Gradle: multi-project dependency graph (supports depth > 2)
task moduleDependencyReport {
doLast {
def file = new File("project-dependencies.dot")
file.delete()
file << "digraph {\n"
file << "splines=ortho\n"
printDeps(file, rootProject)
file << "}\n"
}
}
@tevjef
tevjef / bench
Last active November 27, 2016 04:31
Golang regexp vs strings.Map
bash-3.2$ go test -bench=.
PASS
BenchmarkRegexReplace-4 500000 2470 ns/op 19.83 MB/s 113 B/op 1 allocs/op
BenchmarkMapReplace-4 2000000 813 ns/op 60.22 MB/s 0 B/op 0 allocs/op
@tevjef
tevjef / wtf.go
Last active November 30, 2016 23:24
package main
import (
"fmt"
)
func main() {
structArr()
structLiteral()
}
@tevjef
tevjef / CheeseDetailActivity.java
Last active August 29, 2015 14:25
CheeseDetailActivity.java
/*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software