Skip to content

Instantly share code, notes, and snippets.

Nathan Witmer zerowidth

Block or report user

Report or block zerowidth

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
zerowidth /
Created Aug 11, 2013
Boulder Brain Dump

What even is a Boulder

Here's about 10 minutes of brain dump that could become its own guide with lot more care and attention.

Where to stay

  • Hotel Boulderado: it's right downtown, and walking distance to just about everything
  • Quality Inn & Suites, still downtown-ish.
  • St. Julien, if you're feeling fancy.
zerowidth / atom_id.rb
Created Apr 8, 2013
Jekyll liquid tag for creating atom ids for atom feeds
View atom_id.rb
module Jekyll
module AtomId
# from
def atom_id(post)
zerowidth / highlight_indent_fix.rb
Created Apr 8, 2013
Jekyll monkeypatch to strip leading space from indented `highlight` liquid blocks
View highlight_indent_fix.rb
Jekyll::Tags::HighlightBlock.module_eval do
def render(context)
code = strip_leading_space_from super
if context.registers[:site].pygments
render_pygments(context, code)
render_codehighlighter(context, code)
zerowidth / coffeescript.rb
Created Apr 8, 2013
Jekyll plugins for rendering compass stylesheets and auto-converting coffeescript files without requiring YAML front-matter.
View coffeescript.rb
require "coffee-script"
module Jekyll
# Automatically force coffeescript files to be compiled, even if they don't
# have the YAML front-matter.
class CoffeeConvertor < Generator
def generate(site)
converted = []
site.static_files.each do |sf|
zerowidth / out.txt
Last active Dec 14, 2015
output of toml-test run for toml-parslet library
View out.txt
1.9.3-p385 macallan:~/Desktop/toml-test (master)? ▸ ./toml-test /Users/nathan/code/toml-parslet/script/
Test: duplicate-keygroups (invalid)
Expected an error, but no error was reported.
Test: duplicate-keys (invalid)
Expected an error, but no error was reported.
Test: empty-implicit-keygroup (invalid)
View coordinated.clj
(ns clj-shared-resource.coordinated)
; define a few helper functions
(defn thread-id []
(.getId (Thread/currentThread)))
; because stdout isn't synchronized:
(def logger (agent nil))
(defn log [& msgs]
(send-off logger (fn [_] (apply println (cons ";" msgs)))))
zerowidth / port_tables.rb
Created Feb 14, 2013
Script to parse a text table and convert to a reasonable output. Demonstration of an idiomatic ruby script for a friend.
View port_tables.rb
require "pp"
def convert_to_offsets(widths)
offsets = []
position = 0
widths.each.with_index do |width, index|
offsets << (position...(width+position)) # range does not include the end
position += width + 1 # assume spacing of 1 character
zerowidth / grid.hs
Created Feb 4, 2013
My solutions for, written in Haskell as an exercise. I first solved this puzzle using hacked-together ruby, but the algorithms here are essentially the same. The search in particular is not optimal, as it's a depth-first search rather than using any sort of cost heuristic to search the best paths first, but it works, and I go…
View grid.hs
module Grid where
import Control.Monad
type Pos = Int
type Cost = Int
type Path = [Pos]
type Grid = [Cost]
type GridSize = Int
type CostFn = (Grid -> Path -> Cost)
zerowidth /
Last active Jul 18, 2017
A brief discusson on git workflow preferences (now published on

A colleague asks [slightly edited]:

Why didn't you squash your [feature branch merge] commit? I'm new to [project], but I found on [other project] that squashed commits made it much easier to git bisect. And since the [project] test suite is broken frequently, I assume we'll be git bisecting a lot. Un-squashed commits tended to leave broken tests or functionality that never actually shipped.

Git, because it's just "the stupid content tracker", is flexible enough to support just about any development workflow you can think of. You can use pull

zerowidth /
Created Jan 3, 2013
custom test runners with bash / fuubar / test/unit. hacks heaped upon hacks for a particular dev environment.
function timer() {
if [[ $# -eq 0 ]]; then
echo $(date '+%s')
local stime=$1
etime=$(date '+%s')
if [[ -z "$stime" ]]; then stime=$etime; fi
You can’t perform that action at this time.