Getting better feedback from sinon stubs

DateReadtime 2 minutes Series Part 2 of Testing Express Tags

Sinon is an extremely powerful tools for writting unit tests. It helps to create standalone spies, stubs and mocks to isolate functionallity.

Setting up Sinon

The documentation suggests you can, for example, create a spy like so:

it('calls the original function', function () {
    var callback = sinon.spy();
    var proxy = once …
more ...

Extending Supertest

DateReadtime 3 minutes Series Part 1 of Testing Express Tags

I have an express app running behind an Apache reverse proxy with mod_auth_mellon used to authenticate users via SAML.

As a result of relying on headers for auth, I have lots of mocha tests that look like:

it("should add a comment with a user", (done) => {
    let expectedUser = "a User …
more ...

View git diff by word


By default, git diff will highlight differences by line.

Differences highlighted word by word:

$ git diff --word-diff

Differences highlighted character by character:

$ git diff --word-diff-regex=.

Differences highlighted word by word without extra characters:

$ git diff --color-words

Differences highlighted character by character without extra characters:

$ git diff --color-words=.

More information can …

more ...

Pretty printing of git commit history

DateReadtime 6 minutes Tags

Helpful git logging aliases

Helpful aliases for viewing git commit history: logg, logga, loggs, loggsa, logd, logda, logdr, and logdra.

The aliases combine to utilize the same set of flags in different combinations:

--color:show colored
--graph:text-based graphical representation of the commit history
--date-order:show no parents before all …
more ...

Pretty Printing from the Commmand Line



The python standard library provides a json library that can be used to pretty print json.

$  echo '{"this": ["that"]}' | python -m json.tool
  "this": [


$  echo '<root><foo a="b">lorem</foo><bar value="ipsum" /></root>' | xmllint --format -
<?xml version="1.0"?>
  <foo a="b">lorem</foo …
more ...

Safely force pushing with Git

DateReadtime 2 minutes Tags

I want to modify the most recent commit but its already been pushed to origin. Using the --force-with-lease flag I can "more safely" push to origin and overwrite the existing data.

The --force-with-lease flag checks to make sure the remote repo matches the local cache. In other words, it ensures …

more ...

Rescue a missing git stash

DateReadtime 2 minutes Tags

I lost a git stash the other day mysteriously. Here is the process I used to recover a lost stash.

Where is my Stash?

Lets assume you have a git stash:

$ git stash
Saved working directory and index state WIP on master: 1f96501 Unmark two old posts as drafts, check …
more ...

CI for latex files

DateReadtime 1 minutes Tags

I wanted to make a build pipeline for my resume which is written in Latex. Using Travis CI, I was able to add a build that would upload an automatically compiled PDF as a release for every tag in a git repository.

sudo: required
dist: trusty
- sudo apt-get -qq …
more ...