Skip to content

Instantly share code, notes, and snippets.

View YuraLaguta's full-sized avatar

Yuri YuraLaguta

View GitHub Profile
body { background: #222; color: #e6e6e6; }
a { color: #949494; }
a:link, a:visited { color: #949494; }
a:hover, a:active, a:focus { color: #c7c7c7; }
hr { border-bottom: 1px solid #424242; border-top: 1px solid #222; }
@YuraLaguta
YuraLaguta / LifecycleJob.kt
Created September 25, 2018 06:26 — forked from LouisCAD/LifecycleCoroutines.kt
A job that automatically gets cancelled when the lifecycle is destroyed. Meant to be used as a parent to your coroutines in lifecycle aware components.
import android.arch.lifecycle.GenericLifecycleObserver
import android.arch.lifecycle.Lifecycle
import android.arch.lifecycle.Lifecycle.Event.ON_DESTROY
import android.arch.lifecycle.LifecycleOwner
import kotlinx.coroutines.experimental.CoroutineScope
import kotlinx.coroutines.experimental.Dispatchers
import kotlinx.coroutines.experimental.Job
import kotlinx.coroutines.experimental.android.Main
fun Lifecycle.createJob(cancelEvent: Lifecycle.Event = ON_DESTROY): Job = Job().also { job ->
@YuraLaguta
YuraLaguta / gist:04b27d3fa3c8d3923f8884a8b910b3bd
Created September 6, 2018 09:53 — forked from yqritc/gist:ccca77dc42f2364777e1
Equal column spacing for Android RecyclerView GridLayoutManager by using custom ItemDecoration

ItemOffsetDecoration

public class ItemOffsetDecoration extends RecyclerView.ItemDecoration {

    private int mItemOffset;

    public ItemOffsetDecoration(int itemOffset) {
        mItemOffset = itemOffset;
    }
@YuraLaguta
YuraLaguta / iterm2-solarized.md
Created July 26, 2018 01:36 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)

Default

Default

Powerlevel9k

Powerlevel9k

@YuraLaguta
YuraLaguta / gist:1daf8de5417bba3794c60e88ba5d6a92
Last active October 20, 2018 23:57
Aliases for git for oh-my-zsh goes at the end of ~/.zshrc
export ANDROID_HOME=/Users/yura.laguta/Library/Android/sdk/
#export PATH=$ANDROID_HOME/bin:/usr/local/bin:$PATH
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
# Path to your oh-my-zsh installation.
export ZSH="/Users/yura.laguta/.oh-my-zsh"
DEFAULT_USER=`whoami`
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="agnoster"
@YuraLaguta
YuraLaguta / Project.xml
Created May 23, 2018 06:50
Android xml sorting part of AS code project settings
<codeStyleSettings language="XML">
<option name="FORCE_REARRANGE_MODE" value="1" />
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
<arrangement>
<rules>
<section>
<rule>
<match>
@YuraLaguta
YuraLaguta / presentation.md
Created November 7, 2017 00:54 — forked from marukami/presentation.md
Android Quality Matters - Part 1: Build Foundations

Shared Dependencies Versions

// dependencies.gradle
ext.versions = [
    code               : 1,
    name               : '1.0',

    minSdk             : 16,
    targetSdk          : 26,
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.trifork.example"
android:installLocation="auto"
android:versionName="@string/client_info" >
<!-- ... -->
<application
android:hardwareAccelerated="true"
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="config_app_name">AVélib</string>
<string name="config_authority">com.cyrilmottier.android.avelib.citybikes</string>
<string name="config_com.google.android.maps.v2.api_key">XXX</string>
</resources>