Skip to content

Instantly share code, notes, and snippets.

@zenobht
zenobht / colortrans.py
Created September 1, 2020 00:25 — forked from MicahElliott/colortrans.py
Convert values between RGB hex codes and xterm-256 color codes.
#! /usr/bin/env python
""" Convert values between RGB hex codes and xterm-256 color codes.
Nice long listing of all 256 colors and their codes. Useful for
developing console color themes, or even script output schemes.
Resources:
* http://en.wikipedia.org/wiki/8-bit_color
* http://en.wikipedia.org/wiki/ANSI_escape_code
@zenobht
zenobht / discovery-testing-example.md
Created December 23, 2017 22:43 — forked from searls/discovery-testing-example.md
Discovery testing example: rewriting td.verify()

I'm currently undergoing a 9-month-long in-place rewrite of testdouble.js (which has proven to be a really stupid idea, but mildly entertaining at least).

This morning, my goal was to break down the responsibilities of the totally not unit-tested td.verify() function with a number of smaller modules which are test-driven with an outside-in approach.

I get a bunch of questions about how I "actually" do this, so I logged each step I took in a separate commit. You can see the 9 steps I took, including the final step—realizing that the contract I'd created was not how I wanted, refactoring one of the dependencies' contracts before it had even been written!

  1. Psuedo code the module with comments to start shaking out desirable names of dependencies
  2. [Define thos