In-Terminal Screenshots with iTerm2, Capybara, and Poltergeist

The latest builds of iTerm2 support an API for displaying images in the terminal. It can display any Base64-encoded PNG or JPEG image inline or as a download. Guess what, Poltergeist can render the current page as a… Base64-encoded PNG or JPEG! Let’s combine the two with this little snippet of Ruby in our spec_helper.rb file:

def show_screenshot(width = 640)
  print "\033]1337;File=;inline=1;width=#{width}px:"
  print page.driver.render_base64
  print "\a\n"

Combine this with a call to Pry’s binding.pry and now you can interact with your page and see the results of your capybara commands. Kind of like a web browser, but in your terminal!


The Changelog #100: Go programming with Rob Pike and Andrew Gerrand

“Notes” posts are my free-form reactions to podcasts, books, movies, TV and other media. They may be a mixture of summaries and my own insights and thoughts.

  • Small, composable
  • Pragmatism / Minimalism
  • Designed by consensus of 3 people
  • Not “language designers” - but programmers
  • Splash Keynote Problems at Google with 10 million lines of C++ (
  • Started as systems langauge
  • Plan 9: Never caught on, ideas still relevant
  • Andrew: Go glob, community (HN), release binaries
  • Google imports OOS, not vice-versa - no GOOG branding anywhere
  • Go designed for lots of code, large environments
  • Right palette of tools for systems vs. python
  • Not all can be replaced with Go: LoC, latency (GC)
  • No Makefiles or metadata, don’t need complex build system
  • In Google, used:
    • YouTube MySQL “proxy”/load balancer
    • (talks on
    • groupcache
  • contemporary stdlib solves modern problems (e.g., JSON)
  • Webserver in 10 LoC
  • Goal: Keep language in head, 50 pg. spec
  • Productive in a weekend
  • 1.2: Focus on more tools that understand go code)
    • December 1, 2013

First Post!

I really wanted to focus on writing content and developing unique content rather than fuss with “solved problems” like blogging platforms. I even briefly played with Squarespace but was underwhelmed by their template selection and overwhelmed by their control panel. I didn’t want to have my content look like everyone else that uses Octopress.

I just wanted a few simple features:

  • Markdown posts
  • Drag-and-drop image uploading
  • Code snippet support with syntax highlighting
  • Unique, simple, lightweight, and responsive design that focuses on content

So I did what any web programmer would do… against my better judgement I’ve decided to build my own blog engine:

  • Rails 4 / Ruby 2
  • Slim for templates
  • Redcarpet for parsing Markdown
  • stringex for URL slug generation
  • sqlite3 for storage (for now, I may migrate to an PostgreSQL or ElasticSearch backend)
  • pygments.rb for syntax highlighting

Why Write Your Own Blog App? Why Rails?

Sure, Rails is probably overkill for this. But its a known quantity. It actually started when I just wanted to experiment with HTML and render some Scss. It wasn’t long after I found myself saying “I’ll just add a Post model”, and finally a had my own “blog engine”.

It’s rather specific at the moment and doesn’t really offer much in terms of groundbreaking functionality. After the code settles a bit, I’d like to clean it up and release it.