Skip to content

Instantly share code, notes, and snippets.


Tyler Freeman odbol

View GitHub Profile
odbol / FractionsSequence.kt
Created Dec 5, 2022
Kotlin sequence generator for stepping through float ranges without accumulating floating-point errors
View FractionsSequence.kt
fun generateSequenceOfFractions(
range: ClosedFloatingPointRange<Float>,
step: Float
): Sequence<Float> {
val multiplier = 1f / step
val start = floor(range.start * multiplier).toInt()
val endInclusive = ceil(range.endInclusive * multiplier).toInt()
return generateSequence(start) { it + 1 }
.takeWhile { it <= endInclusive }
.map{ it.toFloat() / multiplier }
odbol / Utils.ts
Created Oct 3, 2022
Utility functions for parsing querystrings and other useful JS goodies
View Utils.ts
/** Returns the first querystring parameter with the given key, or null if not found. */
export function getParam(param: string): string|null {
var dataCallbackMatches = new RegExp(param + '=([^&]+)').exec(document.location.href);
if (dataCallbackMatches) {
return dataCallbackMatches[1];
} else {
return null;
odbol / Deferred.ts
Created Aug 4, 2022
Deferred: a Promise that you can resolve or reject after the fact.
View Deferred.ts
* A Promise that you can resolve or reject after the fact.
export class Deferred<T> {
private _resolve?: (result: T) => void;
private _reject?: (error: Error) => void;
promise: Promise<T>;
constructor() {
this.promise = new Promise((resolve, reject) => {
odbol / PendingRequest.ts
Created Aug 4, 2022
PendingRequest: a way to implement Promise-based APIs across process boundaries like iframes or ServiceWorkers.
View PendingRequest.ts
import {Deferred} from './Deferred.js'; // See
* A PendingRequest.
export interface PendingRequest<T> {
* Id of the request for resolving/rejecting later.
requestId: number;
odbol / AnimationUtils.ts
Created Jul 15, 2022
Collection of mathy math functions for mathing and animating
View AnimationUtils.ts
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 / CsvCredentialsProvider.mjs
Created Apr 28, 2022
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...
View CsvCredentialsProvider.mjs
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.
View gist:9df51f6bb323c979efe7b8b6310a557a
I am attesting that this GitHub handle odbol is linked to the Tezos account tz1cdfM7UEtbMt6fMUyGJ4sf5UVNMHEwnEGZ for tzprofiles
odbol / RxFirebaseUtils.kt
Created Aug 3, 2021
Utilities for converting Firebase results to RxJava Observables
View RxFirebaseUtils.kt
package com.odbol.rx
import io.reactivex.Emitter
import io.reactivex.Observable
import io.reactivex.Single
import io.reactivex.SingleEmitter
odbol /
Last active May 10, 2021 — forked from nickaknudson/
TimePicker DialogPreference for Android - fixed to respect user's 24 hour formatting preferences
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 ( on keybase.
  • I have a public key ASCGfcow9kaIAW9XZ6jpjOlbnPZLbHm7arhB8gKESG9pHAo

To claim this, I am signing this object: