Skip to content

Instantly share code, notes, and snippets.

Michael Hackett MichaelHackett

  • Halifax, NS, Canada
View GitHub Profile
@MichaelHackett
MichaelHackett / ListPaddingDecoration.java
Created May 31, 2019 — forked from vincetreur/ListPaddingDecoration.java
A RecyclerView.ItemDecoration that adds 8 dp padding to the top of the first and bottom of the last item in a list (or RecyclerView in this case).
View ListPaddingDecoration.java
import android.content.Context;
import android.graphics.Rect;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.View;
/**
* Adds 8dp padding to the top of the first and the bottom of the last item in the list,
@MichaelHackett
MichaelHackett / NSMutableArray+Indexing.m
Created Mar 18, 2014
Implementation of NSArray shorthand subscripting as found in iOS 6 / OS X 10.8. (Not tested.)
View NSMutableArray+Indexing.m
@implementation NSMutableArray (Indexing)
- (void)setObject:(id)object atIndexedSubscript:(NSUInteger)index
{
if (index == [self count]) {
[self addObject:object];
} else {
[self replaceObjectAtIndex:index withObject:object];
}
}
You can’t perform that action at this time.