Skip to content

Instantly share code, notes, and snippets.

View ValCanBuild's full-sized avatar

Valentin Hinov ValCanBuild

View GitHub Profile
@ValCanBuild
ValCanBuild / drawer_layout_preview.xml
Created September 10, 2015 09:35
Android preview DrawerLayout NavigationView
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
//
// ControllerAware Protocol
// Shows how to have view controller instances which implement
// a specific protocol have it's method called on viewDidLoad.
import UIKit
protocol ControllerAware {
func onViewDidLoad()
}
@ValCanBuild
ValCanBuild / ReachabilityAware.swift
Last active January 25, 2016 23:41
Constrained View Controller extension which displays a "No Internet Connection" message when reachability is lost. To use it simply extend your existing ViewController and make it implement ReachabilityAware and call the startMonitoryReachability() method.
// Constrained View Controller extension which display a "No Internet Connection" message when reachability is lost.
// This implementation depends on ReachabilitySwift (https://github.com/ashleymills/Reachability.swift).
// It can easily enough be adapted to other frameworks.
// Assumes you have a localized string with the key "warning.no_internet_connection" in one of your .strings files.
// Call startMonitoringReachability() in viewWillAppear and stopMonitoringReachability() in viewDidDisappear
import ReachabilitySwift
protocol ReachabilityAware {
func startMonitoringReachability()
@ValCanBuild
ValCanBuild / TypicalUseCase.java
Created February 20, 2017 20:49
TypicalUseCase
view.showLoadingIndicator();
loadFromServer()
.compose(applySchedulers())
.subscribe(data -> {
view.hideLoadingIndicator();
view.showData();
}, throwable -> {
view.hideLoadingIndicator();
@ValCanBuild
ValCanBuild / BranchDeleter.sh
Last active July 25, 2017 08:32
Deletes all merged git branches older than the provided date.
#!/bin/sh
cd ../..
date=$1 #Format: 2015-01-15
root_branch=$2 #Format: origin/branchName e.g. origin/release/1_6
DRY_RUN=$3
numberDeleted=0
@ValCanBuild
ValCanBuild / cl_guidline_barrier_bug.xml
Created October 9, 2017 10:00
ConstraintLayout 1.1.0 beta2 guideline barrier bug
<!-- This works in 1.1.0-beta1 but breaks in 1.1.0-beta2.
textView3 is always constrained to textView1, even when the barrier should clearly be at the guideline -->
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
@ValCanBuild
ValCanBuild / .travis.yml
Last active March 1, 2018 17:00
TravisAndrodArticle deploy part of .travis.yml
deploy:
provider: releases
skip_cleanup: true
overwrite: true
api_key:
secure: oVvKZhQGC9fhquSLNuYclzH7XdZusVclYJBNHc4MUHkcUJTcTZdQHb1NYFGeaWH1BXvQ9Po58bhpJefHLqMeWvy3/6yyLYPXCQMvT4b7Xi3rkinNVjvoM/RaYHun9R6BAxK/mw8mIC9uVTJHD4jj/rLQsG4Jq/ZEDJyKA8SeHLmDxS82u/1nhDVNZrxd1nMdribkkrxUnsOy2ErH4gJv8O+nbQS3w8JJry26zkh13EKovPrSBe3ogmIlF3gYRZuBbpMAoTYeSQ1uPAapMJEwqIdyeBasTyFmU29Qec3OG/Ud4MB3tK3FF3IFTjygM6SNO4MLn5x8VLnSlthlou9BOXXogqpg5smF1N91/bSWuiDfiRH1nqBX9k7sLy4UjCOaGfP74YAOF8GWHtYVEC2UOvWS4KtZX46gq6ejFibl4gRvtjqLYemBb5M/aczSjJXRMFXOx/X8zxpJ8Dx4K2ioyFqraaFhdyIm5Be3JQmwDr7GfkTapwnbV1ru3UPiXoRdfYgh9yxnSeehUES1m73Fsd29IWlHYZfhCFBF7wOgI5z7P3mKEVPpt/Xx9TBOnoZrS3PhabuG6BmSRhIfPd3s2j6U8YH5Pu/DRANBqJuK7+YlFtEBOP8txUuYzLDU0lLDGyOK/EzIm1jguxUMVfhk5OlracL/3kOeMETXP7+VCw8=
file_glob: true
file: /home/travis/build/ValCanBuild/TravisAndroidExample/app/build/outputs/apk/release/*
on:
repo: ValCanBuild/TravisAndroidExample
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:src="@drawable/ic_add_black_24dp"
app:fabSize="normal"
app:layout_anchor="@id/navigation"
app:layout_anchorGravity="top|end"
app:layout_behavior="com.mypackage.BottomNavigationFABBehavior"
@ValCanBuild
ValCanBuild / build.gradle
Last active November 8, 2018 08:28
TravisAndroidArticle starting gradle file
android {
// rest of file cut for readability
signingConfigs {
release
}
buildTypes {
release {
minifyEnabled false