Skip to content

Instantly share code, notes, and snippets.

hameno /
Created Jul 26, 2019 — forked from ChristophKaser/
Room Database Migration Utility
package cc.gunz.mobilecatalog.database.base;
import android.database.Cursor;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
hameno / ExtendedFileProvider
Last active May 2, 2019
"Enhanced" FileProvider with support for external secondary paths (based on 27.0.2)
View ExtendedFileProvider
* Copyright (C) 2013 The Android Open Source Project
* 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
hameno / Bug.kt
Last active Jun 10, 2017
Bug with Kotlin + Moshi
View Bug.kt
import com.squareup.moshi.Json
import com.squareup.moshi.KotlinJsonAdapterFactory
import com.squareup.moshi.Moshi
import org.junit.Test
data class DataClass(
@Json(name = "par1") val par1: String?,
@Json(name = "par2") val par2: String?,
@Json(name = "par3") val par3: String?,
@Json(name = "par4") val par4: String?,
hameno / publishMavenLocal.gradle
Last active Nov 26, 2019 — forked from Robyer/maven-publish-helper-usage.gradle
Gradle script for publishing Android library to local Maven repository using maven-publish plugin. With dependencies (also handling transitive: false and custom exclude rules), including sources and javadoc.
View publishMavenLocal.gradle
apply plugin: 'maven-publish'
project.afterEvaluate {
def androidExtension = project.extensions.findByName("android")
if (androidExtension.hasProperty('libraryVariants')) {
androidExtension.libraryVariants.all { final variant ->
task("${}Javadoc", type: Javadoc) {
description "Generates Javadoc for ${}."
failOnError = false
source = variant.javaCompile.source
hameno /
Last active Sep 18, 2016 — forked from abs/gist:c0d598996870dda719b3
Downloads and installs the startssl CA certs into the global Java keystore
# Downloads and installs the startssl CA certs into the global java keystore
# Author: Klaus Reimer <>
# Updated: Philip Schiffer <>
# Check if JAVA_HOME is set
if [ "$JAVA_HOME" = "" ]

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called (Functional) Reactive Programming (FRP).

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.ScaleGestureDetector;
import android.view.View;
import android.widget.FrameLayout;
hameno / java.pp
Created Jan 2, 2014
Dependencies: puppetlabs/apt
View java.pp
class java {
class { 'apt': }
# Add PPA
apt::ppa { 'ppa:webupd8team/java': } ->
# Prepare response file
file { "/tmp/oracle-java7-installer.preseed":
source => 'puppet:///modules/java/java.response',
mode => 600,
backup => false,
} ->
View SafeAsyncTask
package com.asynctask.util;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.concurrent.Callable;

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url =

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: