Skip to content

Instantly share code, notes, and snippets.

Avatar

Tyler Freeman odbol

View GitHub Profile
@odbol
odbol / gist:11194196
Created Apr 22, 2014
Parse hex string and redisplay as base 10 and character equivalents.
View gist:11194196
var str = "90036F4920203080030049202030",
res = [];
for (var i = 0; i < str.length; i += 2) {
var hex = str.substr(i, 2),
num = parseInt(hex, 16),
char = String.fromCharCode(num)
pr = hex + "\t" + num + "\t" + char + "\n";
res.push(pr);
@odbol
odbol / gist:11274002
Created Apr 25, 2014
Test Updating Firmware on the BCM20732S via HCI UART
View gist:11274002
/**
BCM20732S HCI UART is connected to Serial RX/TX pins on the Arduino Due.
BCM20732S Reset pin is connected to BLE_RESET_PIN
**/
#include <Arduino.h>
#define BLE_RESET_PIN 31
View untrusted-lvl12-solution.js
/*
* robotNav.js
*
* The green key is located in a slightly more
* complicated room. You'll need to get the robot
* past these obstacles.
*/
function startLevel(map) {
// Hint: you can press R or 5 to "rest" and not move the
@odbol
odbol / EventBus.java
Last active Jan 2, 2019
An event bus for pub/sub to UI related-events. Based on RxJava
View EventBus.java
package com.odbol.sensorizer.eventbus;
import io.reactivex.Observable;
import io.reactivex.functions.Predicate;
import io.reactivex.subjects.PublishSubject;
import io.reactivex.subjects.ReplaySubject;
import io.reactivex.subjects.Subject;
/***
* An event bus for pub/sub to UI related-events.
@odbol
odbol / RxBroadcastReceiver.java
Created Nov 1, 2016
A class for translating Android's BroadcastReceiver events into an RxJava Observable. Automatically unregisters the BroadcastReciever when you unsubscribe.
View RxBroadcastReceiver.java
package com.odbol.rx;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import rx.Observable;
import rx.Subscriber;
import rx.functions.Action0;
@odbol
odbol / SwipeToDeleteHelper.java
Last active Jan 7, 2019
Swipe to delete / dismiss on a RecyclerView using ItemTouchHelper
View SwipeToDeleteHelper.java
package com.odbol.android;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.helper.ItemTouchHelper;
import android.view.View;
@odbol
odbol / json_lines.js
Created Aug 27, 2019
Parse JSON Lines file in the browser with Javascript. http://jsonlines.org/
View json_lines.js
function parseJsonLines(file) {
let results = [];
for (let i = 0; i < file.length;) {
const end = file.indexOf('\n', i);
if (end < 0) {
end = file.length;
}
const currentLine = file.substring(i, end);
@odbol
odbol / Authentication.js
Created Feb 21, 2020
Firebase login: the easiest way, with promises
View Authentication.js
/**
* Handles logging in to Firebase.
*/
class Authentication {
authPromise;
constructor() {
this.authPromise = new Promise((resolve, reject) => {
firebase.auth().onAuthStateChanged(function(user) {
if (user) {
@odbol
odbol / AnimationUtils.java
Last active Dec 4, 2020
Various utilities for animation and graphics.
View AnimationUtils.java
package com.odbol.utils;
/**
* Various utilities for animation and graphics.
*/
public class AnimationUtils {
/**
* Interpolate a value with specified extrema, to a new value between new extrema.
*
View keybase.md

Keybase proof

I hereby claim:

  • I am odbol on github.
  • I am odbol (https://keybase.io/odbol) on keybase.
  • I have a public key ASCGfcow9kaIAW9XZ6jpjOlbnPZLbHm7arhB8gKESG9pHAo

To claim this, I am signing this object: