Skip to content

Instantly share code, notes, and snippets.


Vladimir Baryshnikov vovkab

View GitHub Profile
vovkab /
Created Mar 8, 2018
Monitors main thread for timeouts.
package io.wondrous.sns.utils;
import android.os.Handler;
import android.os.Looper;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
public class MainThreadWatchDog {
public static final long MAIN_THREAD_PING_INTERVAL = 200;
vovkab /
Last active Apr 14, 2019
Example of using Dagger 2 in libraries
package com.example;
import java.lang.annotation.Retention;
import javax.inject.Inject;
import javax.inject.Scope;
import javax.inject.Singleton;
import dagger.Binds;
import dagger.BindsInstance;
vovkab / repo
Created Nov 3, 2017
gerrit repo
View repo
Show traces:
$ repo --trace <command>
Upload for review with topic set to current branch name:
$ repo upload -t
review.URL.uploadtopic = true
View gradle
gradlew :app:dependencyInsight --configuration testCompile --dependency kotlin-reflect
gradlew :tapp:dependencyInsight --configuration appDebugCompileClasspath --dependency okhttp
Resolve all dependencies. Force gradle to precache dependencies for all configurations:
allprojects {
task resolveAllDependencies {
doLast {
configurations.all { it.resolve() }
vovkab / android-recycler-merge-adapter-tools
Last active Feb 25, 2017
Tools for RecyclerMergeAdapter
View android-recycler-merge-adapter-tools
* Calculates correct item position based on RecyclerAdapter and ViewHolder adapter position.
* Takes in consideration RecyclerMergeAdapter and adjust position accordingly
* @param adapter RecyclerAdapter with access to RecyclerView instance
* @param viewHolder ViewHolder that was created by @adapter
* @return adjusted local position for viewHolder
public static int getLocalPosition(RecyclerAdapter adapter, RecyclerView.ViewHolder viewHolder) {
int position = viewHolder.getAdapterPosition();
vovkab / gist:d9f76e3429cdf20a4e0c
Created Jan 13, 2016 — forked from ohmrefresh/gist:55149f68c41a148ae673
How to Server-side verification of Google Play subscriptions
View gist:d9f76e3429cdf20a4e0c
1.create google app (google console)
Client ID
Email address
Client secret xxx
Redirect URIs
Javascript Origins
View genymotion
sudo ln -s /usr/local/bin/VBoxManage /usr/bin/VBoxManage
View okhttp-decode-gzip-response
private String decodeBody(Response response) throws IOException {
final ResponseBody body = response.body();
if (body == null) return null;
if (isZipped(response)) {
return unzip(response.body());
} else {
return body.string();
vovkab / android-memory-class
Last active Jun 12, 2017
Android device memory class
View android-memory-class
ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
int memoryClass = manager.getMemoryClass();
48 - Samsung Nexus S
64 - Samsung Galaxy Nexus
Samsung S2
Samsung S3
128 - Samsung S4
vovkab /
Created Oct 21, 2014
Installing HAXM for Mac OS 10.10

Enable unsigned kext to be installed:

$ sudo nvram boot-args="kext-dev-mode=1"
You can’t perform that action at this time.