Showing posts with label svgo. Show all posts
Showing posts with label svgo. Show all posts

Sunday, April 22, 2012

Tumblr Grid

Attending the inaugural golang ny group at the Tumblr offices, inspired me to add tumblrgrid to the collection of SVGo clients. Tumblrgrid makes a SVG file that displays a flexible, clickable grid of pictures from a set tumblr blogs, possibly filtered with tags. Data may be read from a live network or from a local cache. You can get tumblrgrid with:
$ go get github.com/ajstarks/svgo/tumblrgrid
You will need to edit the source to add your own tumblr API key. The command options are:
 -f=false: read from local files
 -g=5: gutter (pixels)
 -n=30: picture limit
 -nc=5: number of columns
 -p=false: link to original post
 -tag="": filter tag
 -tw=75: thumbnail width
An interesting use of tumblrgrid is to view pictures from related tumblrs. For example, this list:
f0o0od.tumblr.com
ign0ranceisbliiiss.tumblr.com
agilaagira.tumblr.com
geek-art.tumblr.com
represents a chain of tumblrs that refer to each other. After collecting them in a file called tlist, this command line:
$ tumblrgrid -nc 4 -n 20 `cat tlist`
produces:
Changing the command line to
$ tumblrgrid -nc 2 -n 20 `cat tlist`
reduced the number of columns to 2 which causes the labels to be rotated.

Saturday, October 15, 2011

Documenting Code and Pictures

For the SVGo workshop I had to document many examples of code+pictures, so I created a workflow to create consistently formatted illustrations of SVGo code and the pictures they produce. Below is the script that automates the process. The heart of the script is a small Go program, codepic which creates a SVG file of code and picture:
Here's the script:
#!/bin/sh
for i in $*
do
    base=`basename $i .go`
    gofmt -w -spaces -tabindent=false -tabwidth=4 $i &&
    goc $base && 
    ./${base} > ${base}.svg && 
    codepic -codeframe=f -font Inconsolata -fs 14 -ls 16 $i > ${base}-slide.svg && 
    svg2pdf ${base}-slide.svg
done
for each file the script:
  1. formats the source
  2. builds the source
  3. runs the program and captures its output
  4. make a slide showing the code and output
  5. convert the slide to PDF for inclusion in Keynote