Skip to content

Instantly share code, notes, and snippets.

Peter Tackage peter-tackage

Block or report user

Report or block peter-tackage

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
peter-tackage / ViewModelClear.kt
Created Apr 17, 2020
Simulates teardown of Android ViewModel
View ViewModelClear.kt
fun ViewModel.tearDown() {"clear")
.apply { isAccessible = true }(this)
peter-tackage / gist:7168528
Last active Dec 26, 2015
Cancellable Target Callback for Square Picasso
View gist:7168528
import com.squareup.picasso.Picasso;
import com.squareup.picasso.Target;
public class CancelableTarget implements Target {
protected Target mTarget;
private boolean mIsCancelled;
peter-tackage /
Created Nov 4, 2015 — forked from mttkay/
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;
peter-tackage / strings.xml
Created Mar 6, 2015
Formatted links in Android resources
View strings.xml
<?xml version="1.0" encoding="utf-8"?>
<string formatted="false" name="html_link"><![CDATA[<a href=\"%s\">%s</a>]]></string>
peter-tackage /
Created Mar 27, 2014
Integer array incrementer
public class Incrementer {
public static int[] increment(int[] input) {
int index = input.length -1;
while(++input[index] % 10 == 0) {
input[index] = input[index] % 10;
if(index == 0) {
int[] result = new int[input.length + 1];
result[0] = 1;
return result;
peter-tackage / gist:9250638
Created Feb 27, 2014
Flipview from Android Youtube examples
View gist:9250638
* Copyright 2012 Google Inc. All Rights Reserved.
* 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
You can’t perform that action at this time.