Skip to content

Instantly share code, notes, and snippets.

View MisterRager's full-sized avatar

A. Rager MisterRager

View GitHub Profile
@MisterRager
MisterRager / Rx2ServiceBindingFactory.java
Last active July 17, 2019 18:46
Bind to an Android service using RxJava!
import android.app.Service;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Binder;
import android.os.IBinder;
import io.reactivex.Observable;
/*
* Copyright (c) 2017 PlanGrid, Inc. All rights reserved.
*/
package com.plangrid.android.loaders.rx;
import android.database.Cursor;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.CursorLoader;
@MisterRager
MisterRager / DataUpdate.java
Last active May 25, 2017 19:03
A way to solve the "in-memory" vs "in-database" data modeling problem
/*
* Copyright (c) 2017 PlanGrid, Inc. All rights reserved.
*/
package com.plangrid.android.dmodel.mapper;
import java.util.concurrent.atomic.AtomicReference;
import rx.Observable;
import rx.functions.Action1;
@MisterRager
MisterRager / Dockerfile
Created May 8, 2017 21:08
Dockerfile for JDK 7 android builds
# Start with JDK7
FROM java:7-jdk
# Init dependencies for the setup process
RUN dpkg --add-architecture i386 \
&& apt-get update \
&& apt-get install -y \
software-properties-common \
python-software-properties \
unzip \
@MisterRager
MisterRager / RxLoaderBridge.java
Last active January 28, 2017 20:00
Android Loader to RxJava bridge: Now updated for RxJava2!
/*
* Copyright (c) 2017 PlanGrid, Inc. All rights reserved.
*/
package com.plangrid.android.loaders;
import android.os.Bundle;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.Loader;
@MisterRager
MisterRager / RxServiceBinding.java
Last active March 23, 2017 19:41
RxServiceBinding: observe the binding of a service
/*
* Copyright (c) 2017 PlanGrid, Inc. All rights reserved.
*/
package com.plangrid.android.services.rx;
import android.app.Service;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
{
"recordVersion": 1,
"platforms": {
"ios": {
"releases": {
"expired": {
"expirationDate": -1,
"notes": "Default expired version"
}
},
@MisterRager
MisterRager / DebounceIntentService.java
Last active June 30, 2016 02:00
A debounced IntentService
/*
* Copyright (c) 2016 PlanGrid, Inc. All rights reserved.
*/
package com.plangrid.android.services;
import android.app.IntentService;
import android.content.Intent;
import android.os.Bundle;
function partial_apply(){
$args = func_get_args();
$funk = array_shift($args);
return function() use ($args, $func){
$func_args = func_get_args();
call_user_func_array($funk, $args + func_args);
};
}
@MisterRager
MisterRager / kitchen_sink_handle_nut.stl
Created April 13, 2015 03:02
kitchen sink handle nut thing (stl format)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.