While my engineering background (9 extensive years of daily coding and 4 years of software producing/tech leading/management/sales) is essential to my job as a CEO of an engineering company, that isn’t what I want to focus on today.
Through the course of my day as the CEO of Railsware, I have to consume and produce immense amounts of information. Because of this, it becomes very handy to be able to keep up with it via some engineering magic.
A regexp here, a JavaScript bookmarklet there. A firebug inspection for this, a line of Ruby code for that, and, finally, a bash trick over there.
Today, I wanted to share a simple issue resolution. I’m to mirror my Excel spreadsheet (rotating data by turning rows into columns and vice versa).
A quick search for Microsoft Excel revealed a transpose feature in special paste. However, being an Apple aficionado, I use Numbers – so no transpose.
What should I do? Copy/paste by hand? No way! Instead, I turn to Ruby, always a piece of cake. And so it was. Two minutes of Numbers menu/search browsing plus seven minutes of Googling vs. 2 minutes 23 seconds of coding (code snippet below).
data="";data_reverse=[] puts "past your tab separated data and finish with " begin data << gets end while data[-2..-1]!="n data.split("n").each{|l| l.split("t").each_with_index{|v,x| (data_reverse[x]||=[]) << v} } puts data_reverse.collect{|line| line.join("t")}.join("n")
So, my dear fellow CEOs, CFOs, and C*Os from all around the world, learn to code – it will save you a lifetime!