Skip to content

Instantly share code, notes, and snippets.


Bernat Borrás Paronella alorma

View GitHub Profile
aballano / ThenRx.kt
Created Nov 16, 2018
Mockito & RxJava extensions to facilitate mocking
View ThenRx.kt
fun <T> OngoingStubbing<Observable<T>>.thenError(throwable: Throwable) {
fun OngoingStubbing<Completable>.thenComplete() {
amake /
Last active Sep 28, 2021
Correct localization on Android 7

Correct localization on Android 7

Prior to Android 7, the system had a single preferred locale, and fallback behavior was quite rudimentary. Starting with Android 7, the user can now specify a priority list of locales, and fallback behavior is improved.

However, in many cases it is still surprisingly difficult to make full use of locale fallback, and there are some hidden gotchas when trying to fully support both Android 7 and earlier versions.

* Copyright 2016 Google 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
* Unless required by applicable law or agreed to in writing, software
alxsimo /
Last active Dec 15, 2016
[Rx] RxFirebaseRemoteConfig
package com.milanuncios.milanunciosandroid.common.remoteconfig;
import com.alexsimo.toolbelt.optional.Optional;
import com.milanuncios.milanunciosandroid.BuildConfig;
import java.util.Map;
import rx.AsyncEmitter;
import rx.Observable;
View getch.h
#ifndef _GETCH_H_
#define _GETCH_H_
#include <termios.h>
#include <unistd.h>
#include <stdio.h>
/* reads from keypress, doesn't echo */
int getch(void)
gabrielemariotti /
Last active Jan 24, 2019
How to manage the firebase libraries in a multi-module projects

Centralize the firebase libraries dependencies in gradle

ext {
      firebaseVersion = '9.0.0';

      firebaseDependencies = [
              core :         "${firebaseVersion}",
              database :     "${firebaseVersion}",
              storage :      "${firebaseVersion}",
pedrovgs /
Last active Oct 18, 2019
Interfaces for presenters in MVP are a waste of time!

##Interfaces for presenters in MVP are a waste of time!

It's been a long time since we started talking about MVP. Today, the discussion is about if creating an interface for the Presenter in MVP is needed.

This is the Model View Presenter pattern's schema:

MVP Schema

In this schema the Model box is related to all the code needed to implement your business logic, the presenter is the class implementing the presentation logic and the view is an interface created to abstract the view implementation.

public final class Result<S, F> {
private final Optional<S> success;
private final Optional<F> failure;
public Result(Optional<S> success, Optional<F> failure) {
this.success = success;
this.failure = failure;
View button_login_facebook.xml
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android=""
<shape android:shape="rectangle" >
<corners android:radius="10dp"/>
<solid android:color="@color/blue_facebook"/>
twiceyuan / gist:0c1b7faa6fad2d3cad42
Last active Apr 23, 2019 — forked from z8888q/gist:7280681
[如何动态改变 App 图标] #Android How to change an application icon programmatically in Android
View gist:0c1b7faa6fad2d3cad42
//1 . Modify your MainActivity section in AndroidManifest.xml, delete from it, line with MAIN category in intent-//filter section
<activity android:name=""
<action android:name="android.intent.action.MAIN" />