Skip to content

Instantly share code, notes, and snippets.

View MyDogTom's full-sized avatar

Svyatoslav Chatchenko MyDogTom

View GitHub Profile
@MyDogTom
MyDogTom / jacoco.gradle
Created April 14, 2018 17:04 — forked from almozavr/jacoco.gradle
Gradle Jacoco config for Android (3.x plugin) with kotlin and custom excludes support
apply plugin: "jacoco"
jacoco {
toolVersion = deps.test.jacocoVersion
}
tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
}
@MyDogTom
MyDogTom / ThreeTenTypeAdapters.java
Created April 1, 2018 07:17 — forked from baudm/ThreeTenTypeAdapters.java
Gson TypeAdapters for JSR-310 backport (org.threeten.bp.**) classes
/*
* Copyright 2016 Darwin Bautista
*
* 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
@MyDogTom
MyDogTom / LoginComponent.kt
Created October 12, 2017 13:56
Article: Modularization. Gist2. LoginComponent
@Component(
modules = arrayOf(LoginModule::class),
dependencies = arrayOf(LoggedOutComponent::class))
@FeatureScope
interface LoginComponent {
fun inject(activity: LogInActivity)
@Component.Builder
interface Builder {
fun loggedOutComponent(component: LoggedOutComponent): Builder
@MyDogTom
MyDogTom / LoggedOutComponent.kt
Created October 12, 2017 13:47
Article: Modularization. Gist1. LoggedOutComponent
@Singleton
@Component(modules = arrayOf(PersistenceModule::class))
interface LoggedOutComponent {
fun userRepository(): UserRepository
}
@MyDogTom
MyDogTom / AndroidSchedulersHook.java
Created February 8, 2016 07:30
test rule for rxSchedulersHook
package rx.plugins;
import rx.Scheduler;
import rx.android.plugins.RxAndroidSchedulersHook;
import rx.schedulers.Schedulers;
/**
* Created by ata on 07.02.2016.
*/
public class AndroidSchedulersHook extends RxAndroidSchedulersHook {
@MyDogTom
MyDogTom / gist:56ba3b64f2eaf146f5f7
Created January 26, 2016 14:01
configure console2 with githbash
source: http://code.logos.com/blog/2011/06/git_bash_in_console2.html
Git Bash in Console2
I started using Console2 after reading Scott Hanselman’s recommendation. Not only can it display a regular command prompt and PowerShell in tabs (as he describes), any console process can be added. msysgit users can add Git Bash to by opening the Settings dialog and adding a tab with the following properties:
Title: Git Bash
Icon: C:\Program Files (x86)\Git\etc\git.ico
Shell: C:\Windows\SysWOW64\cmd.exe /c ""C:\Program Files (x86)\Git\bin\sh.exe" --login -i"
Startup dir: C:\YourCode
@MyDogTom
MyDogTom / capslock_remap_alt.ahk
Created November 17, 2015 11:34 — forked from Danik/capslock_remap_alt.ahk
Autohotkey Capslock Remapping Script. Makes Capslock function as a modifier key to get cursor keys etc. on the left side of the keyboard, so you never have to move your hand to the right.
; Autohotkey Capslock Remapping Script
; Danik
; More info at http://danikgames.com/blog/?p=714
; danikgames.com
;
; Functionality:
; - Deactivates capslock for normal (accidental) use.
; - Hold Capslock and drag anywhere in a window to move it (not just the title bar).
; - Access the following functions when pressing Capslock:
; Cursor keys - J, K, L, I
@MyDogTom
MyDogTom / example1.java
Last active February 13, 2018 18:01
rxJava observeOn and subscribeOn explanation source: https://github.com/ReactiveX/RxJava/issues/2925#issuecomment-98649659
Observable.just(1) // 1 will be emited in the IO thread pool
.subscribeOn(Schedulers.io())
.flatMap(...) // will be in the IO thread pool
.observeOn(Schedulers.computation())
.flatMap(...) // will be executed in the computation thread pool
.observeOn(AndroidSchedulers.mainThread())
.subscribe(); // will be executed in the Android main thread (if you're running your code on Android)