Ruby: Executing code only if file was called directly

I wanted a way to treat a Ruby file as both an importable library or a script. The best solution I could find was as follows: if __FILE__ == $0 #script / run as self code goes here end If the file is called directly a la ruby ./library.rb, the code within that if block will be executed. If included, FILE, the file that this code exists in will not match $0, the file being executed and the code in that block will not be executed. [Read More]

Ruby: Use .each on anything

While parsing several variables that could be strings or arrays of strings, I found myself doing too much type checking and my code was getting ugly. I wished there was a way to execute each on types that weren’t containers.

[Read More]

Studying for the GRE

I recently took theĀ Graduate Record Examinations (GRE) General Test as part of the application process to get into a technical masters program. I had only a few weeks to prepare for it and was given advice of all kinds from many sources, some of it helpful, some of it not. Below is a list I’ve compiled of the advice that was helpful along with some of my own: Find out what score you should be shooting for By all means, reach for the sky and try to get the best score you can, but within reason. [Read More]

My Long Haul Through College

I’m an Engineer. I spent eight years of my life trying to become one. Why so long? I would like to say that I consider four of those years to be my High School years but that would be a lie. High School for me was less about my future than it was about being liked and getting good enough grades to avoid being lectured by parents and teachers. I was in advanced classes and did decent, but I would not have considered myself a good student. [Read More]

And So It Begins...

Hello and welcome to my blog at “PatrickBaumann.com,” a personal blog1about career and life written from the perspective of an engineer recently out of college. I am a graduate from a moderately-sizedĀ state university in central Minnesota as well as a new resident in the great state of California (budgets be damned, this place is still a joy to live). Prior to graduating with a degree in Computer Engineering, I interned with and was eventually hired full-time by The Boeing Company in Anaheim, CA. [Read More]