Whitney O'Banner

society • internet • code

Read this first

Why write tests for Rails apps?

Unit tests are your friend. The sooner you make peace with the fact that your quality of life will drastically increase when you unit test your code, the better. Seriously.

This excerpt was taken from the official Rails documentation.

Remember, unit tests should be FIRST – fast, isolated, repeatable, self-verifying, and timely.

View →


Rails Workflow

Today, I made a couple (tiny) Rails apps.

Granted, Rails generators handled a lot of the black magic; but I was able to establish a simple workflow to get up and running quickly, and I would like to share it with you.

Do the following in your terminal. Use vim. Be a rockstar.

Rails Workflow

A few simple steps when starting a new Rails project

  • rails new <app_name>

  • Commit

  • Update Gemfile to include gems for testing

    • e.g. RSpec, FactoryGirl, Capybara
    group :development, :test do
        gem "rspec-rails"   
    end
    
    group :test do
        gem "capybara"
        gem "launchy"
        gem "factory_girl_rails"
        gem "database_cleaner"
    end
    
  • Commit

  • Generate RSpec stuff

    • bundle exec rails generate rspec:install
  • Commit

  • Generate controller

    • rails generate controller <controller_name>
  • Generate model

    • rails generate model <model_name>
  • Commit

  • Write a (failing) controller test inside...

Continue reading →


Performant JavaScript

If you need to share functionality across instances of a class, it is massively more performant to share functionality via prototypes.

This was a huge takeaway from yesterday’s lecture by @sgharms at Dev Bootcamp on inefficient versus efficient method sharing in JavaScript.

Using JS prototype functions to share functionality amongst instances of a class is significantly more performant and uses less memory than encapsulating shared methods in the constructor function.

Who knew.

Continue reading →


Work at a Predictable Pace

When your team becomes tired and demoralized they will get less work done, not more, no matter how many hours are worked. Becoming over worked today steals development progress from the future.

The Rules of Extreme Programming by Don Wells

View →


Naming Variables

Russ Cox writes:

A name’s length should not exceed its information content. For a local variable, the name i conveys as much information as index or idx and is quicker to read. Similarly, i and j are a better pair of names for index variables than i1 and i2 (or, worse, index1 and index2), because they are easier to tell apart when skimming the program. Global names must convey relatively more information, because they appear in a larger variety of contexts. Even so, a short, precise name can say more than a long-winded one: compare acquire and take_ownership. Make every name tell.

The information content metric gives a quantitative argument against long-winded names: they’re simply inefficient. I internalized this metric years ago but only realized this phrasing of it recently, perhaps because I have been looking at too much Java code.

Yes, x sucks, but maybe I should stop writing...

Continue reading →


The Seven Spiritual Laws of Success

The following notes were taken while reading The Seven Spiritual Laws of Success by Deepak Chopra. They reflect key takeaways and reminders from each chapter.

  • The Law of Pure Potentiality

    Judge nothing that occurs.

  • The Law of Giving

    Give / receive fully and joyfully to everyone.

  • The Law of Karma

    Choose consciously, for everything in life is a choice. Do not choose discomfort.

  • The Law of Least Effort

    Practice acceptance, responsibility, and defenselessness. Be vulnerable and do not resist what is.

  • The Law of Intention and Desire

    Attend the present, intend the future. Desires manifest through intention and mindful attention to the present moment.

  • The Law of Detachment

    Embrace uncertainty. Detach from outcomes.

  • The Law of Dharma

    Align purpose with fulfilling the needs of humanity. Use unique talents to serve others, and wealth will flow abundantly.

Continue reading →


Why I Chose Dev Bootcamp

Programming bootcamps are the new hotness in Silicon Valley. From App Academy to HackReactor, there is an exhaustive list of immersive programs springing up in the tech mecca of San Francisco and beyond, offering eager students the opportunity to become junior web developers at a fraction of the cost of a CS degree. If you possess the time, money, and diligence to pursue a coding camp – the colloqiual term for 3 months of grueling work and self-sacrifice – and happen to live in a major city like SF or New York, you will find no shortage of offerings to accelerate your path to junior level hacker. In this short post, I will discuss why I chose Dev Bootcamp over the rest.

But first, a bit of context

I have an undergraduate degree in Computer Science. I already know (more or less) how to program. Over the past four years, I have managed to secure jobs at two of the most prestigious...

Continue reading →


I am the 2%

It is often difficult to express the feelings of discouragement, detachment, isolation, and self-doubt that come with being the anomaly of the tech industry. After a career of 4+ years at giant Silicon Valley tech companies, where racial diversity amongst my colleagues is – ahem – nil, I believe it is the appropriate time to speak out about the dangers and the reality of stereotype threat.

Minority Report

Google workforce demographics

Examine the chart above.

For every 100 Googlers, 30 are women. 2 are black.

Yawn. Those numbers are starting to sound familiar (sorry, but I am looking at you, Yahoo and Apple and Facebook and LinkedIn and Twitter). The numbers don’t sound promising for someone who looks like me. Google and others humbly published their diversity statistics, but those big data reveals – supporting empirical evidence that had already been identified – only reintroduced an unwelcome wave of the...

Continue reading →


Thoughts on blogging

Writing is hard. Writing about technical topics is harder.

Great writing demands clarity and conciseness when expressing ideas. This is especially important when discussing technical topics with a varied audience that might include non-technical readers.

This blog began as a requirement for Dev Bootcamp. It was intended to be the beginning of an online presence and a means to display the technical skills I’ve acquired over the many phases of the program. But it has since become much more than that. I use this blog as a tool to practice my own creative writing. I use it as an outlet to teach others. I use it to learn how to build from scratch. While remaining mostly technical in subject matter, this is a blog that is really teaching me how to blog.

While it seems trivial in theory, producing great content for a blog is a challenging skill to master and requires much practice. If you do...

Continue reading →