Roblog

eight posts from 2014

  • Command-line purging of Varnish caches

    Varnish, the HTTP proxy, is a fantastic tool. Here’s a way to purge cached pages from the command line, a task I find myself wanting to do frequently.
  • A Caching Analogy

    Explaining caching is hard; here’s an attempt.
  • Ruby regular expressions: the /o modifier

    An explanation of the little-used – but handy-to-know – o modifier to Ruby’s regular expressions.
  • Real progress in long-running command-line scripts

    Sometimes, you write Ruby scripts that take a long time to execute. Here’s how to show progress to your scripts’ users – part two in a series, this time showing how to display real progress to users.
  • Faking progress in long-running command-line scripts

    Sometimes, you write Ruby scripts that take a long time to execute. Here’s how to show progress to your scripts’ users – part one in a series, this time dealing with how to show indeterminate, faked progress to reassure users that something is happening.
  • Persisting data in Ruby with PStore

    Ruby comes with a powerful persistent storage system that’s backed by flat files and handles concurrent access and transactions out of the box – stuff you’d expect to need a database for. It’s criminally underused, and it’s called PStore. Never roll your own file locking code again!
  • Paths aren't strings

    If you find yourself passing around lots of file paths in your Ruby scripts, you should save yourself a headache and use Pathnames, not strings.
  • Nokogiri as a command-line tool

    Most Rubyists are familiar with [Nokogiri][]. It’s a combination XML and HTML parsing tool most commonly used for “screen scraping”: that is, fetching a web page, and searching through it to extract information of interest. When a website you’re interested in doesn’t offer an API, it’s often the only way to extract information from it.