Home Stuff to do with programming

Go package: tidyhtml

I wrote a package for Go that makes HTML neat and tidy.

What it does is turns something like this:

<!doctype html>
<html lang="en">
<head>
<title>demo</title>
</head>
<body>
<div><h1>this is a demo</h1>
<p>
ok
</p>
<div><span>this will do</span></div></div>
</body></html>

…into this vision:

<!doctype html>
<html lang="en">
<html>
    <head>
        <title>demo</title>
    </head>
    <body>
        <div>
            <h1>this is a demo</h1>
            <p>ok</p>
            <div>
                <span>this will do</span>
            </div>
        </div>
    </body>
</html>

Now, if somebody views the page source on this website (I think this must happen all the time) then all of the indentation and whitespace will look pretty neat. Phew!

Remake: a watcher tool for Make

I like using Make for my projects, even though I don’t understand some of the design decisions ($< > $@, naturally). Still, it’s installed everywhere and it does a pretty good job. But it doesn’t run automatically, and that is a problem.

There are other build systems and ways to automate make, but I wanted something that would:

  • watch and restart builds
  • work with Make
  • work with any target in any Makefile
  • require no setup/configuration
  • have no command line arguments to forget

So I created Remake with all of that in mind. Instead of running make [target] you run remake [target], and that’s it.

For example, if you have a Makefile like this:

app: $(wildcard *.go)
    go build

http: app $(wildcard templates/*)
    app -http

test: $(wildcard *.go)
    go test

You could run remake http, edit some files, and it would automatically restart the server. You could also run remake test to automatically run tests after each change. Or you could run remake http test to do both.

I have a few ideas for improvements but it’s already pretty handy. It’s available on GitHub so check it out there.

Making rbutcher.com

I was thinking that, since I build them for a living, I should probably have a website. So here is the beginning of one. It is still very much in-progress.

I’m using this as an opportunity to get more experience using the Go programming language, which is being used behind the scenes to generate static pages from markdown files, the Flickr API, etc. I’m enjoying it.

The only 3rd party front-end libraries used are jQuery and Font Awesome. Except for those 2 things, all of the HTML, CSS and JavaScript has been written from scratch. This includes:

  • the resizable, lazy-loading photo grid below
  • the resizable photo pages with keyboard and touch swipe navigation
  • that useless navigation pointer on the left

It is also responsive, and looks alright on mobile and tablet devices. I mean, alright considering that the site was designed by a programmer.