Skip to content

Instantly share code, notes, and snippets.

View openam's full-sized avatar
💭
...

Michael Tuttle openam

💭
...
  • Vivint Solar
  • Utah, United States
View GitHub Profile
@openam
openam / gist:3c46586001bef21f1e0f
Last active August 29, 2015 14:13 — forked from thomseddon/gist:3511330
AngularJS byte format filter
app.filter( 'bytes', function bytesFilter () {
'use strict';
return function bytesReturn ( bytes, precision ) {
if ( bytes === 0 ) {
return '0 bytes';
}
if ( isNaN( parseFloat( bytes ) ) || !isFinite( bytes ) ) {
return '-';
@openam
openam / compare-branches.sh
Created February 24, 2015 16:27
Check for commits on one branch that are not in another branch, and export them to the desktop.
#!/bin/bash
if [[ $# -lt 2 ]]; then
echo "
Usage: compare-branches baseBranch compareBranch
Shows what commits exist in the second branch that are not in the first"
exit
fi
@openam
openam / zsh.md
Last active August 29, 2015 14:18 — forked from tsabat/zsh.md

Prereq:

apt-get install zsh
apt-get install git-core

Install oh-my-zsh.

Keybase proof

I hereby claim:

  • I am openam on github.
  • I am openam (https://keybase.io/openam) on keybase.
  • I have a public key ASB6PCk7-1_Qo8LqHABHiWGB3ollnif5gYem9RO_TNbdKAo

To claim this, I am signing this object:

@openam
openam / try-catch.ts
Last active March 24, 2025 19:11 — forked from t3dotgg/try-catch.ts
Theo's preferred way of handling try/catch in TypeScript
// Types for the result object with discriminated union
type Success<T> = [T, null]
type Failure<E> = [null, E]
type Result<T, E = Error> = Success<T> | Failure<E>;
// Main wrapper function
export async function tryCatch<T, E = Error>(
promise: Promise<T>,
): Promise<Result<T, E>> {
try {