This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<android.support.design.widget.CoordinatorLayout 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" | |
tools:context="com.vacuum.app.cinema.MainActivity"> | |
<!--SOME CODE FOR MY AppBarLayout--> | |
<!--SOME CODE FOR MY ToolBar--> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.SharedPreferences | |
import android.os.Bundle | |
import android.os.Parcel | |
inline fun <reified T : Enum<T>> Bundle.getEnum(key: String, default: T) = | |
getInt(key).let { if (it >= 0) enumValues<T>()[it] else default } | |
fun <T : Enum<T>> Bundle.putEnum(key: String, value: T?) = | |
putInt(key, value?.ordinal ?: -1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Top-level build file where you can add configuration options common to all sub-projects/modules. | |
buildscript { | |
repositories { | |
jcenter() | |
maven { url 'https://maven.fabric.io/public' } | |
google() | |
} | |
dependencies { | |
classpath 'com.android.tools.build:gradle:3.0.1' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Updates docker-compose to the latest release | |
# | |
# Author: Emiliano Gabrielli <[email protected]> | |
DESTINATION_FILE="${DESTINATION_FILE:-$(command -v docker-compose)}" | |
set -e -o pipefail |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Copyright 2017 ModelBox Inc. | |
* | |
* 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a super simplified example of how to use the new dagger.android framework | |
// introduced in Dagger 2.10. For a more complete, in-depth guide to dagger.android | |
// read https://proandroiddev.com/how-to-android-dagger-2-10-2-11-butterknife-mvp-part-1-eb0f6b970fd | |
// For a complete codebase using dagger.android 2.11-2.17, butterknife 8.7-8.8, and MVP, | |
// see https://github.com/vestrel00/android-dagger-butterknife-mvp | |
// This example works with Dagger 2.11-2.17. Starting with Dagger 2.11, | |
// @ContributesAndroidInjector was introduced removing the need to define @Subcomponent classes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// for any errors that should be handled before being handed off to RxJava. | |
// In other words global error logic. | |
// An example might be 401 when not logging in | |
import okhttp3.Interceptor | |
import okhttp3.Response | |
class ErrorInterceptor: Interceptor { | |
override fun intercept(chain: Interceptor.Chain?): Response { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker logs nginx 2>&1 | grep "127." | |
# ref: http://stackoverflow.com/questions/34724980/finding-a-string-in-docker-logs-of-container |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RunWith(AndroidJUnit4.class) | |
public final class RxSnackbarTest { | |
@Rule public final ActivityTestRule<RxSnackbarTestActivity> activityRule = | |
new ActivityTestRule<>(RxSnackbarTestActivity.class); | |
private Snackbar view; | |
@Before public void setUp() { | |
RxSnackbarTestActivity activity = activityRule.getActivity(); | |
view = activity.snackbar; |