Skip to content

Instantly share code, notes, and snippets.

Matthias Käppler mttkay

Block or report user

Report or block mttkay

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
mttkay / coffee.scala
Last active Sep 4, 2018
Passing functions, not objects as collaborators
View coffee.scala
class Coffee
class Order
class CoffeeMaker {
def startCoffee(): Unit = ???
def isCoffeeReady: Boolean = ???
mttkay / geth.log
Created Jun 15, 2016
get --fast logs
View geth.log
I0615 09:11:30.700609 core/blockchain.go:751] imported 6 receipt(s) (0 ignored) in 1.002706ms. #372705 [bb0cce10… / 690c5ba5…]
I0615 09:11:31.994642 core/blockchain.go:751] imported 17 receipt(s) (0 ignored) in 2.624429ms. #372722 [5185b9fa… / 8c6fe057…]
I0615 09:11:32.029927 core/headerchain.go:294] imported 178 header(s) (14 ignored) in 24.758826ms. #374733 [297a5f22… / bb1ef962…]
I0615 09:11:32.602010 core/blockchain.go:751] imported 14 receipt(s) (0 ignored) in 1.509627ms. #372736 [e00911b5… / ccbd5a6b…]
I0615 09:11:32.914538 core/headerchain.go:294] imported 192 header(s) (0 ignored) in 22.871789ms. #374925 [c03127ff… / bcffe252…]
I0615 09:11:32.942771 core/blockchain.go:751] imported 19 receipt(s) (0 ignored) in 11.930873ms. #372755 [1c601c38… / 7a58945a…]
I0615 09:11:33.500175 core/blockchain.go:751] imported 20 receipt(s) (0 ignored) in 4.984327ms. #372775 [3de5382c… / 639f5c5f…]
I0615 09:11:33.536139 core/headerchain.go:294] imported 192 header(s) (0 ignored) in 27.151351ms. #375117 [a858cb8f… / 11d1
mttkay / report.txt
Created Jun 15, 2016
Mix 1.0.5 crash
View report.txt
Process: Mix-ide [31034]
Path: /Applications/
Identifier: .
Version: ??? (mix )
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Mix-ide [31034]
User ID: 502
Date/Time: 2016-06-15 09:09:57.574 +0200
mttkay /
Created Nov 4, 2015
A simple Rx based pager
public class Pager<I, O> {
private static final Observable FINISH_SEQUENCE = Observable.never();
private PublishSubject<Observable<I>> pages;
private Observable<I> nextPage = finish();
private Subscription subscription = Subscriptions.empty();
private final PagingFunction<I> pagingFunction;
private final Func1<I, O> pageTransformer;
mttkay /
Last active Dec 21, 2015
An AsyncTask.
class DownloadTask extends AsyncTask<String, Void, File> {
protected File doInBackground(String... args) {
final String url = args[0];
try {
byte[] fileContent = downloadFile(url);
File file = writeToFile(fileContent);
return file;
} catch (Exception e) {
// ???
mttkay / gist:6050054
Created Jul 21, 2013
Note that you must setRetainInstance(true); otherwise the Observable and all associated state will get destroyed of course. So make sure you don't create strong references to views/context in onCreate or onActivityCreated, or they will leak. The nice thing about this is that there apart from splitting up the code for creating the observable from…
View gist:6050054
package com.github.super8.fragments;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.GridView;
import com.github.super8.R;
View foo_activity.xml
<TextView style="@style/my_textview_style" .../>
View styles.xml
<?xml version="1.0" encoding="utf-8"?>
<style name="my_textview_style" parent="@android:style/Widget.TextView">
<item name="android:id">@+id/my_text</item>
View ids.xml
<?xml version="1.0" encoding="utf-8"?>
<item name="my_text" type="id" />
TextView text = (TextView) findViewById(;
You can’t perform that action at this time.