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
peter-tackage / Pager.java
Created Nov 4, 2015 — forked from mttkay/Pager.java
A simple Rx based pager
View Pager.java
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
peter-tackage / strings.xml
Created Mar 6, 2015
Formatted links in Android resources
View strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string formatted="false" name="html_link"><![CDATA[<a href=\"%s\">%s</a>]]></string>
</resources>
@peter-tackage
peter-tackage / Incrementer.java
Created Mar 27, 2014
Integer array incrementer
View Incrementer.java
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
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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@peter-tackage
peter-tackage / gist:7168528
Last active Dec 26, 2015
Cancellable Target Callback for Square Picasso
View gist:7168528
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import com.squareup.picasso.Picasso;
import com.squareup.picasso.Target;
public class CancelableTarget implements Target {
protected Target mTarget;
private boolean mIsCancelled;
You can’t perform that action at this time.