Skip to content

Instantly share code, notes, and snippets.

danielesegato / TestFlowCollector.kt
Last active Jan 25, 2021
TestFlowCollector to test kotlin coroutines Flow
View TestFlowCollector.kt
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.*
import kotlinx.coroutines.launch
import kotlinx.coroutines.test.TestCoroutineScope
import org.junit.Assert.*
import kotlin.coroutines.coroutineContext
import kotlin.reflect.KClass
danielesegato /
Last active Apr 8, 2021 — forked from liberorignanese/
Android TextInputLayout with credit card mask
import android.content.Context;
import android.text.Editable;
import android.text.Spannable;
import android.text.TextWatcher;
danielesegato /
Last active Nov 19, 2019
Android Library Publishing Maven Artifacts via gradle

What is this

This gitst contains a script to push Android libraries as artifacts on a maven repository using the gradle build system.

It is somewhate a fork of Chris Banes gradle push script.

This was me while trying to understand how to setup maven publishing with gradle:

confused AF

Documentation is absent or very lacking and I found no script handling javadoc properly for Android.

danielesegato /
Last active Jul 25, 2016 — forked from davidgf/serverless
Bash completion for Serverless

To enable serverless bash completion:

  • Install serverless: npm -g serverless
  • Append the servereless.bash code to the .bashrc or .bash_profile file in your home directory

This gitst is a fork of It avoid using find .to look for lambda functions: the command, if executed in the root directory or a big directory, can be really bad for performances. It also add subcommand handling for non-functions.

The script instead look for the serverless project file s-project.json starting from the current directory and looking up,

danielesegato /
Last active Feb 4, 2020
RxJava: Creating Observable from legacy asynchronous API using callbacks

About the gist

EDIT: This has become soon obsolete when Observable.fromAsync() has been released in RxJava. An issue from JakeWarthon here: ReactiveX/RxJava#4177 generated a pull request which is being implemented / discussed here: ReactiveX/RxJava#4179 . See below on how to use it.

I'm learning RxJava. Many Rx-libraries out there are using Obvservable.create() with an inline OnSubscribe implementation to wrap legacy APIs, like this one for the Android GoogleMap API:

class MapFragmentMapReadyOnSubscribe implements Observable.OnSubscribe<GoogleMap> {
  final MapFragment fragment;
danielesegato /
Created Oct 23, 2014
TESTCASE: Debug very slow on ART for method Html.fromHtml() - android bug 77984
package com.neosperience.projects.playgroundandroid;
import android.os.Bundle;
import android.text.Html;
import android.text.Spanned;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
danielesegato / .gitignore
Last active May 5, 2017
Android development Git Ignores
View .gitignore
# Android
# Old Android
# suggestion: also ignore libs/*.properties files for old eclipse project
# can't be added here because multiple libs/ directory can be around in different paths
danielesegato /
Last active Mar 27, 2019
Android Option Menu + Fragments Workaround with ViewPager / ActionBar / Drawer, Menu Items not displaying

This gist is a workaround to this bug:

No changes are needed to your current code but changing the extended fragment/activity class.

All you have to do is put this two classes in your code and make your activity extend MenuManagerActivity and your fragment MenuDelegatorFragment. If you are using Nested fragment you must make sure that all fragments containing nested Fragments with options menu also extend MenuDelegatorFragment (both if the parent fragment need an option menu both if it doesn't need it).

danielesegato /
Created Aug 9, 2013
This is the log of the make command when compiling from Android. Following this guide: With the modifications I describe in the comments of that guide to compile for android-9
/usr/bin/cmake -H/home/mastro/ws/third-parties/assimp -B/home/mastro/ws/third-parties/assimp/buildandroid --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/mastro/ws/third-parties/assimp/buildandroid/CMakeFiles /home/mastro/ws/third-parties/assimp/buildandroid/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `/home/mastro/ws/third-parties/assimp/buildandroid'
make -f code/CMakeFiles/assimp.dir/build.make code/CMakeFiles/assimp.dir/depend
make[2]: Entering directory `/home/mastro/ws/third-parties/assimp/buildandroid'
cd /home/mastro/ws/third-parties/assimp/buildandroid && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/mastro/ws/third-parties/assimp /home/mastro/ws/third-parties/assimp/code /home/mastro/ws/third-parties/assimp/buildandroid /home/mastro/ws/third-parties/assimp/buildandroid/code /home/mastro/ws/third-parties/assimp/buildandroid/code/CMakeFiles/assimp.dir/DependInfo.cmake --color=
make[2]: Leaving directory `