Code & Craft

Software, hardware, and sysadmin talk.

Latest Posts

Filed under: Code & Craft

Dependency Injection in Ruby

Dependency injection is a technique to decrease and make more explicit the coupling between two classes by moving a dependency from deep within the dependent class to its initializer.

Filed under: Code & Craft

Welcome to Jekyll Bootstrap

Welcome to Jekyll Bootstrap, a new from-scratch iteration at a Jekyll theme, written using Bootstrap v4. By default, the first paragraph will appear in the index summary, complete with styling. If you define an excerpt_separator in the post’s frontmatter, you can have more or fewer paragraphs in the index excerpts. Try it!

This post can be found in the _posts directory, following the convention of

Filed under: Code & Craft

Jekyll Inline Conditionals With Liquid Filters

Often times when writing Jekyll templates, we need to do some conditional matching on certain blocks of text, returning one value in one instance, and a different value in another instance. Many times only a small portion needs to be changed, such as the name of a class, or inserting a default value when a variable is nil.

Filed under: Code & Craft

Getting Started With Docker

Speak to anybody working in DevOps today, and Docker will be one of the hot topics of interest. At its core, Docker is a modular, layered approach to vitalization that runs on top of a host system’s kernel while keeping guest processes and filesystems separated.

Filed under: Code & Craft

pgrep and pkill: A Better killall?

Just learned a new tool that has somehow escaped me the last 15 years. prep is a simple tool that lets you grep through the names of running processes, returning just the PIDs. pkill takes that a step further, killing the matched processes1. The cool thing is that both support tab-completion under zsh.

  1. A note of warning: pkill will kill processes that match only partially. So pkill Finder will kill Finder and FinderSynExt processes. Be careful! 

Filed under: Code & Craft

Spellcheck your Markdown in Vim

Vim comes built-in with a spell-checker as powerful as graphical text editors like Sublime and Atom, but it isn’t enabled by default because it generally isn’t handy when writing source code. It can be handy though when writing documentation, blog posts, or other in markdown (or your favorite documentation syntax).

Filed under: Code & Craft

Improved Image Captions in Octopress

Thanks to Robert Anderson’s Image Caption tag, Octopress blogs have had the option to add captions to images for some time. There were some limitations I wanted to improve upon so I began hacking away, and created a block version that allows Markdown formatting in the caption text. In addition, I enhanced the treatment of alt tags and relative widths.