Skip to content

Instantly share code, notes, and snippets.

@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>';
}

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:

#!/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
@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);
};
@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 / 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 / clip.sh
Created June 6, 2017 15:54
clip: Delete local branch, with option to force delete unmerged branches
#!/usr/bin/env bash
# clip: Delete local branch, with option to force delete unmerged branches
clip () {
# 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 / target.js
Last active July 15, 2017 17:32
Use CSS selectors in fragment identifiers to anchor a webpage on an arbitrary element.
(function () {
'use strict';
// queryTarget hash delimiter
var HASH_DELIM = '#::';
/**
* @ref https://gist.github.com/nickolasburr/9ebee93c0ac155cc25d54eaf44952a0e
*/
@nickolasburr
nickolasburr / .avrduderc
Created June 20, 2017 00:43
~/.avrduderc configuration file
default_programmer = "arduino";
default_serial = "/dev/tty.usbmodemFD121";
programmer
id = "arduino";
desc = "Arduino Uno";
type = "arduino";
connection_type = serial;
baudrate = 9600;
;
@nickolasburr
nickolasburr / .scrc
Created July 12, 2017 16:32
Personal ~/.scrc file
set color
set craction = 1
set numeric
set !optimize