Skip to content

Instantly share code, notes, and snippets.

@austynmahoney
austynmahoney / CachedRefreshable.java
Last active September 26, 2016 15:15
RxJava Refreshable Pattern
public abstract class CachedRefreshable<P, T> extends Refreshable<P, T> {
protected abstract Observable<T> getSourceObservable(P parameters);
/**
* Return the Observable that gets data from a cached source.
*
* @return Observable from cache item, or null if the cache misses.
*/
protected abstract Observable<T> getCachedObservable(P parameters);
@quentar
quentar / db-rules.js
Last active July 30, 2020 22:35
parse.com db-rules to allow unique columns
////////////// contraining bits libarary
// parse.com CloudCode functions to allow kind-of unique column (when requests do not come for 1 object at the very same time)
// (that may happen with queue of commands, which can cause multiple objects to be created)
// Generic Functions, used as the sample at the end of file
// ALLOW NEW OBJECT, NEW WINNER TAKES IT ALL = OVERWRITE OLD OBJECT
function parseDBrequestUpdateUniqueOne(request,response,dbName,keyName) {
if (request.object.existed() ) {
@mderazon
mderazon / ClearableAutoCompleteTextView.java
Last active November 30, 2018 16:42
a sub class of AutoCompleteTextView that has a dismiss button with OnClearListener when the clear button is clicked
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.widget.AutoCompleteTextView;
/**
* sub class of {@link android.widget.AutoCompleteTextView} that includes a clear (dismiss / close) button with
* a OnClearListener to handle the event of clicking the button