Skip to content

Instantly share code, notes, and snippets.

View patrickcousins's full-sized avatar

Patrick Cousins patrickcousins

View GitHub Profile
@patrickcousins
patrickcousins / VerticalSmoothScrollView.java
Last active September 21, 2016 12:20
VerticalSmoothScrollView from http://stackoverflow.com/questions/5193678/android-horizontalscrollview-smoothscroll-animation-time/13639106 Added vertical computation. NOTE: to use with API 8 or lower you need to find a compat Scroller, ViewPagerIndicator is a good source to look for a compat Scroller.
public class VerticalSmoothScrollView extends ScrollView
{
private OverScroller myScroller; //TODO implement our own scroller, Scroller and OverScroller can usually be swapped
public VerticalSmoothScrollView( Context context, AttributeSet attrs, int defStyle )
{
super( context, attrs, defStyle );
init();
}
#!/bin/sh
# Use SourceGear DiffMerge as mergetool for git in cygwin.
# git config --global mergetool.diffmerge.cmd "diffmergetool.sh \"\$LOCAL\" \"\$REMOTE\" \"\$BASE\" \"\$MERGED\""
# git config --global mergetool.diffmerge.trustExitCode false
# git difftool -t diffmerge branch1..branch2
# Reference: http://www.tldp.org/LDP/abs/abs-guide.pdf
library=githelperfunctions.sh
Header line: explaining the commit in one line
Body of commit message is a few lines of text, explaining things
in more detail, possibly giving some background about the issue
being fixed, etc etc.
The body of the commit message can be several paragraphs, and
please do proper word-wrap and keep columns shorter than about
74 characters or so. That way "git log" will show things
nicely even when it's indented.
robolectric {
// Configure includes / excludes
include '**/*Test.class'
exclude '**/espresso/**/*.class'
// Configure max heap size of the test JVM
//maxHeapSize = '2048m'
// Configure the test JVM arguments - Does not apply to Java 8
//jvmArgs '-XX:MaxPermSize=512m', '-XX:-UseSplitVerifier'
@patrickcousins
patrickcousins / useful android libraries
Last active August 29, 2015 14:20
useful android libraries
Timber: logging
Dagger: Dependency injection
Butterknife: like dagger but injects views and simplifies button code.
RxJava: Reactive concurrency
Retrofit: REST adapter build on RxJava
package com.firebase.client;
import com.firebase.client.core.Constants;
import rx.Observable;
import rx.Subscriber;
import rx.functions.Action0;
import rx.functions.Func1;
import rx.subscriptions.Subscriptions;
public class RxFirebase {
git branch --merged | grep -v '\*\|master\|develop' | xargs -n 1 git branch -d
@patrickcousins
patrickcousins / ViewVisibilityIdlingResource.java
Created April 15, 2016 13:30 — forked from vaughandroid/ViewVisibilityIdlingResource.java
An IdlingResource for Espresso which blocks until a View has a particular visibility state.
package com.vaughandroid.test.espresso.idlingresources;
import android.app.Activity;
import android.os.Handler;
import android.support.annotation.IdRes;
import android.support.annotation.NonNull;
import android.support.test.espresso.*;
import android.view.View;
import java.lang.ref.WeakReference;
@patrickcousins
patrickcousins / ViewVisibilityIdlingResource.java
Created April 15, 2016 13:30 — forked from vaughandroid/ViewVisibilityIdlingResource.java
An IdlingResource for Espresso which blocks until a View has a particular visibility state.
package com.vaughandroid.test.espresso.idlingresources;
import android.app.Activity;
import android.os.Handler;
import android.support.annotation.IdRes;
import android.support.annotation.NonNull;
import android.support.test.espresso.*;
import android.view.View;
import java.lang.ref.WeakReference;
@patrickcousins
patrickcousins / .gitconfig
Created August 23, 2016 18:00
Git config stuff
[color]
ui = auto
[user]
name = zzzz
email = [email protected]
[alias]
last = log -1 HEAD
co = checkout
ci = commit
cm = commit