Skip to content

Instantly share code, notes, and snippets.


Anton Shkurenko tonyshkurenko

Block or report user

Report or block tonyshkurenko

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Debounce.kt
import kotlinx.coroutines.experimental.DefaultDispatcher
import kotlinx.coroutines.experimental.channels.ReceiveChannel
import kotlinx.coroutines.experimental.channels.consumeEach
import kotlinx.coroutines.experimental.channels.produce
import kotlinx.coroutines.experimental.delay
import kotlinx.coroutines.experimental.runBlocking
import kotlin.coroutines.experimental.CoroutineContext
fun <T> ReceiveChannel<T>.debounce(
wait: Long = 300,
vishna / debounce-broadcast.kt
Created Nov 5, 2017
Debounce input from an EditText and relay to a TextView with a timeout.
View debounce-broadcast.kt
package me.vishna.kdebounce
import android.os.Bundle
import android.text.Editable
import android.text.TextWatcher
import android.widget.EditText
import android.widget.TextView
import kotlinx.coroutines.experimental.*
zmts /
Last active Jan 17, 2020
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 21.10.2019


Аутентификация(authentication, от греч. αὐθεντικός [authentikos] – реальный, подлинный; от αὐθέντης [authentes] – автор) - это процесс проверки учётных данных пользователя (логин/пароль). Проверка подлинности пользователя путём сравнения введённого им логина/пароля с данными сохранёнными в базе данных.

Авторизация(authorization — разрешение, уполномочивание) - это проверка прав пользователя на доступ к определенным ресурсам.

Например после аутентификации юзер sasha получает право обращатся и получать от ресурса "" некие данные. Во время обращения юзера sasha к ресурсу vip система авторизации проверит имеет ли право юзер обращатся к этому ресурсу (проще говоря переходить по неким разрешенным ссылкам)

trent-dev / Jetbrains IDE Essential
Last active Aug 8, 2018
Essential Shortcuts for Jetbrains IDEs, including IntelliJ IDEA, Android Studio & others.
View Jetbrains IDE Essential

Jetbrains IDE Essential Shortcuts

This is a list of Jetbrains IDE shortcuts I use everyday.

Comments welcome! Tell me your favorites.

Navigating Between Windows

Change Focus to Window

Zhuinden /
Last active Sep 22, 2017
Thread-local Realm
public class RealmManager {
private ThreadLocal<Realm> realms;
public RealmManager() {
realms = new ThreadLocal<>();
public Realm openRealm() {
danilValeev / ObjectMapper operator for
Last active May 31, 2019
Easy mapping Realm's List and RealmOptional with ObjectMapper
View ObjectMapper operator for

This code helps using ObjectMapper with RealmSwift.

RealmSwift uses List<T> collection for "to many" relashionships and RealmOptional<T> for optional primitive types, but ObjectMapper can't map directly to List<T> and RealmOptional<T>.

With this operators you can properly define RealmSwift's relashionships and optional properties and use <- operator to map them.


import Foundation
brendanw /
Created Aug 17, 2016
RxBus with Sticky Events
* An RxJava-backed EventBus class that can support sending and receiving multiple event types.
* Based on
public class EventBus<T> {
private static EventBus<Object> INSTANCE;
private List<T> events;
lisawray /
Last active Apr 23, 2019
Equal column spacing in a RecyclerView with GridLayoutManager
package com.example.columnspacing
import android.util.Log;
import android.view.View;
dlew /
Created Mar 1, 2016
Automated onError() message generation
public static Action1<Throwable> crashOnError() {
final Throwable checkpoint = new Throwable();
return throwable -> {
StackTraceElement[] stackTrace = checkpoint.getStackTrace();
StackTraceElement element = stackTrace[1]; // First element after `crashOnError()`
String msg = String.format("onError() crash from subscribe() in %s.%s(%s:%s)",
mttkay /
Created Nov 4, 2015
A simple Rx based pager
public class Pager<I, O> {
private static final Observable FINISH_SEQUENCE = Observable.never();
private PublishSubject<Observable<I>> pages;
private Observable<I> nextPage = finish();
private Subscription subscription = Subscriptions.empty();
private final PagingFunction<I> pagingFunction;
private final Func1<I, O> pageTransformer;
You can’t perform that action at this time.