![](../../assets/workflow-optimizations-customizations/banner.jpg) I'm a huge sucker for workflow customization and optimization. I like to tell myself that I'm saving myself time and headaches in the long run, but the reality is I spend more time optimizing my work flow than I actually end up saving from it. But it's fun, and it's even more fun to share my customizations with other people! ## Posts ## I've written several posts about my programming and writing workflow through terminal customizations, Sublime preferences, syntax-specific settings, and so on, including:


03 August 2015

My zsh aliases

17 March 2015
## Misc Tools ## * Batch converting `.erb` files to `.slim` (requires `erb2slim` and `html2slim` gems) by recursing through all sub-directories: ```shell $ for f in **/*.erb; do erb2slim $f ${f/\.erb/.slim}; done $ rm **/*.erb ``` * A Ruby script to pretty-print 2D arrays: ```ruby require 'colorize' def print_table(table, with_header = true) # Calculate widths widths = [] table.each do |line| line.each_with_index do |col, c| widths[c] = (widths[c] && widths[c] > col.length) ? widths[c] : col.length end end # Indent the last column left. last = widths.pop() format = widths.collect { |n| "%-#{n}s" }.join(" | ".black) + " #{'|'.black} %-#{last}s\n" table.each_with_index do |line, i| if i == 0 && with_header printf(format.black, *line) else printf(format, *line) end end end ``` Given a two-dimensional array, `print_table` pretty prints a table that looks a bit like this: ![](https://cloud.githubusercontent.com/assets/6979755/9891532/af277164-5bbb-11e5-8456-89fc69e2fdb7.png) * [JSON Formatter](https://chrome.google.com/webstore/detail/json-formatter/bcjindcccaagfpapjjmafapmmgkkhgoa?hl=en) enables syntax highlighting and collapsible trees with indent guides when working with raw JSON in your browser. One of my favorite features is that holding down `cmd` while collapsing a subtree collapses all of its siblings, too.