Skip to content

Instantly share code, notes, and snippets.

View odbol's full-sized avatar

Tyler Freeman odbol

View GitHub Profile
@odbol
odbol / AnimationUtils.ts
Created July 15, 2022 22:19
Collection of mathy math functions for mathing and animating
export type float = number;
/**
* Interpolate a value with specified extrema, to a new value between new extrema.
*
* @param value the current value
* @param inputMin minimum the input value can reach
* @param inputMax maximum the input value can reach
* @param outputMin minimum the output value can reach
* @param outputMax maximum the output value can reach
@odbol
odbol / CsvCredentialsProvider.mjs
Created April 28, 2022 14:13
Node.js script to read AWS Credentials from the CVS file that the AWS Console provides you. Baffling that they don't offer this by default...
import {promises as fs} from 'fs';
import os from 'os';
import { parse } from 'csv-parse/sync';
/**
* Creates a credential provider to pass to S3Client which reads a credentials
* CSV downloaded from the AWS console.
*
* @param csvFile string path of the CSV file from AWS console.
* @returns a Provider<Credentials> to give to S3Client as the credentials option.
I am attesting that this GitHub handle odbol is linked to the Tezos account tz1cdfM7UEtbMt6fMUyGJ4sf5UVNMHEwnEGZ for tzprofiles
sig:edsigtY7ADXz4xbHrP1P6pQx9fJiZ9piF9bw1fTBhVfKLT1AaZp5X6dfZSey3RirZc1NGxb3spS9eqXGKvhe7fS4zVdgwfXa5DE
@odbol
odbol / RxFirebaseUtils.kt
Created August 3, 2021 20:38
Utilities for converting Firebase results to RxJava Observables
package com.odbol.rx
import com.google.android.gms.tasks.Task
import com.google.firebase.firestore.DocumentReference
import com.google.firebase.firestore.DocumentSnapshot
import com.google.firebase.firestore.ListenerRegistration
import io.reactivex.Emitter
import io.reactivex.Observable
import io.reactivex.Single
import io.reactivex.SingleEmitter
@odbol
odbol / TimePreference.java
Last active May 10, 2021 04:17 — forked from nickaknudson/TimePreference.java
TimePicker DialogPreference for Android - fixed to respect user's 24 hour formatting preferences
package com.xxx.xxx.preference;
package com.odbol.android;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import android.content.Context;

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:

@odbol
odbol / AnimationUtils.java
Last active December 4, 2020 23:50
Various utilities for animation and graphics.
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.
*
@odbol
odbol / Authentication.js
Created February 21, 2020 23:06
Firebase login: the easiest way, with promises
/**
* Handles logging in to Firebase.
*/
class Authentication {
authPromise;
constructor() {
this.authPromise = new Promise((resolve, reject) => {
firebase.auth().onAuthStateChanged(function(user) {
if (user) {
@odbol
odbol / json_lines.js
Created August 27, 2019 04:42
Parse JSON Lines file in the browser with Javascript. http://jsonlines.org/
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 / SwipeToDeleteHelper.java
Last active January 7, 2019 00:24
Swipe to delete / dismiss on a RecyclerView using ItemTouchHelper
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;