Skip to content

Instantly share code, notes, and snippets.

@nickolasburr
nickolasburr / reflog.sh
Created June 6, 2017 14:15
reflog: Pretty format `git reflog show` with optional flag options for refining reflog output
#!/usr/bin/env bash
# reflog: Pretty format `git reflog show` with optional flag options for refining reflog output
reflog () {
if [[ ! "$(git rev-parse --is-inside-work-tree)" ]] 2>/dev/null; then
echo "fatal: Not a git repository (or any of the parent directories): .git"
return 1
fi
# decorated `git reflog show` graph format style
@nickolasburr
nickolasburr / log.sh
Last active June 6, 2017 14:10
log: Pretty format `git log` with optional flag options for refining log output
#!/usr/bin/env bash
# log: Pretty format `git log` with optional flag options for refining log output
log () {
# return if we're not inside an actual work tree
if [[ ! "$(git rev-parse --is-inside-work-tree)" ]] 2>/dev/null; then
echo "fatal: Not a git repository (or any of the parent directories): .git"
return 1
fi
@nickolasburr
nickolasburr / utils.js
Last active June 14, 2017 01:57
Static JavaScript microlibrary for basic exception handling, type checking and coercion, and key/value searching. Built for use in autonomous/embedded environments. Compatible from ECMAScript 5 onward.
/**
* Exception methods
*/
var Exception = {};
// Throw TypeError exception with message
Exception.throwTypeError = function (message) {
throw new TypeError(message);
};
#!/bin/bash
# track: Track lifetime changes of a file (includes renames) via formatted diff log
# @todo: Better error handling, combining flags
E_NOTFOUND=85
E_BADARGS=86
FILENAME="${!#}"
# verify we're checking against a valid filename
if [[ ! -f $FILENAME ]]; then

Keybase proof

I hereby claim:

  • I am nickolasburr on github.
  • I am nickolasburr (https://keybase.io/nickolasburr) on keybase.
  • I have a public key whose fingerprint is 6278 FF69 3F08 C87C 7736 FEBF 1898 4FE1 F545 6C0F

To claim this, I am signing this object:

@nickolasburr
nickolasburr / console.php
Created April 8, 2016 13:57
Log PHP data structures in browser console
<?php
// log information to JS console
function consoleLog ($value) {
echo '<script>console.log(' . json_encode($value) . ')</script>';
}