Skip to content

Instantly share code, notes, and snippets.

Avatar
😞

Artem Zinnatullin :slowpoke: artem-zinnatullin

😞
View GitHub Profile
@artem-zinnatullin
artem-zinnatullin / error_prone_buck.bzl
Created Jan 24, 2020
ErrorProne Integration with Buck
View error_prone_buck.bzl
def apply_error_prone(**kwargs):
# Error Prone should be on by default in Bazel.
if IS_BAZEL:
return kwargs
has_java_files = False
for src in kwargs.get("srcs", []):
if src.endswith(".java"):
has_java_files = True
break
@artem-zinnatullin
artem-zinnatullin / detekt-config.yml
Created Mar 7, 2019
detekt-config.yml for Lyft Android Project
View detekt-config.yml
autoCorrect: true
failFast: false
test-pattern: # Configure exclusions for test sources
active: true
patterns: # Test file regexes
- '.*/test/.*'
- '.*Test.kt'
- '.*Spec.kt'
exclude-rule-sets:
@artem-zinnatullin
artem-zinnatullin / ValidationProcessor.java
Created Sep 20, 2018
Dagger1: allow @scope annotations on Dagger2 Components
View ValidationProcessor.java
/*
* Copyright (C) 2013 Google, Inc.
* Copyright (C) 2013 Square, Inc.
*
* 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
*
View DiscussionGuidelines.md

Guidelines

To keep the arguments and examples to the point there are few helpful rules:

  • No abstract examples/arguments. These cause the discussion to lose focus and make examples harder to follow. The example/argument must be traceable to a real-world problem - ___ is intended to solve real problems, not imaginary ones.
  • Examples must show the full complexity of the problem domain. Simplified examples trivialize the problems and the solutions intended to solve those simplified examples may not work for the complex problems.
  • Examples of problematic ___ code must be the “best way” of writing the code in ___ - if it can be improved then the improved version should be used instead.
  • Arguments must be straight to the point and as concise as possible.
  • Arguments should take the point of view of an average programmer - not the über-programmer who doesn’t make design mistakes.
@artem-zinnatullin
artem-zinnatullin / YourApp.java
Last active Aug 29, 2015
Fix for performance issue in RxJava 1.0.3+
View YourApp.java
// Issue: https://github.com/ReactiveX/RxJava/issues/3119
class YourApp extends Application {
static {
// I recommend you to put this code into static initialization block of Application class
// because Application class will be loaded before you will start doing some work via RxJava
// PLEASE add comment "remove fix from app class… when you'll switch to new version of RxJava"
// near to "compile 'io.reactivex:rxjava:1.0.13'" in your build.gradle
System.setProperty("rx.scheduler.jdk6.purge-force", "true");
@artem-zinnatullin
artem-zinnatullin / build.gradle
Last active Jul 13, 2020
Ignore particular buildType in Android Project
View build.gradle
// Variant 1: For app or library project's build.gradle
android {
variantFilter {
if (it.buildType.name.equals('debug')) {
it.ignore = true
}
}
}
// Variant 2: For root build.gradle with applying only to library projects
@artem-zinnatullin
artem-zinnatullin / GradleWorkersPleaseStopTakingFocus.gradle
Created Jul 21, 2015
Prevent Gradle Workers from taking focus! #DevelopersLikeComfort
View GradleWorkersPleaseStopTakingFocus.gradle
// You can place it in the root build.gradle
allprojects {
tasks.withType(JavaForkOptions) {
// Forked processes like GradleWorkerMain for tests won't steal focus!
jvmArgs '-Djava.awt.headless=true'
}
}
@artem-zinnatullin
artem-zinnatullin / build.gradle
Last active Nov 9, 2019
Android Unit tests logging configuration
View build.gradle
android {
// ...
testOptions.unitTests.all {
testLogging {
events 'passed', 'skipped', 'failed', 'standardOut', 'standardError'
}
}
}
View HelloKotlinOnAndroid.kt
package nice.is.kotlin
import android.content.Context
import android.widget.Toast
class HelloKotlinOnAndroid {
public fun yo(context: Context, text: String) {
Toast.makeText(context, text, Toast.LENGTH_LONG).show();
}
}
@artem-zinnatullin
artem-zinnatullin / build.gradle
Created Jan 27, 2015
App's build.gradle for Kotlin
View build.gradle
apply plugin: 'kotlin-android'
android {
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
}
// NOTICE: dependencies are fixed for build stability
dependencies {
You can’t perform that action at this time.