Skip to content

Instantly share code, notes, and snippets.

View MisterRager's full-sized avatar

A. Rager MisterRager

View GitHub Profile
@MisterRager
MisterRager / apa102.lua
Created February 12, 2015 08:53
apa102 demonstration on nodemcu
start_frame = string.char(
0x00, 0x00, 0x00, 0x00
)
end_frame = string.char(
0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff,
@MisterRager
MisterRager / gist:bf6faf10f0be349b4348
Created April 13, 2015 03:01
Kitchen Sink Handle Nut Thing (openscad format)
difference() {
union(){
cylinder($fn=45, h=6, r=12.5);
translate([0, 0, 6]) {
cylinder($fn=32,h=2, r1=12.5, r2=6.5);
}
translate([0, 0, 7.7]) {
cylinder($fn=6, r=7.2, h=11.3);
};
}
@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.
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 / 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;
{
"recordVersion": 1,
"platforms": {
"ios": {
"releases": {
"expired": {
"expirationDate": -1,
"notes": "Default expired version"
}
},
@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;
@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 / 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 / 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;