26 Jan '13, 11pm

Just finished up my first blog post in a very long time for Pivotal Labs. Refactoring the Deeply-Nested Hash Antipat...

QUIZ = { question_1: { prompt: "What is your name?" }, question_2: { prompt: "What is your favorite color?", display_proc: ->(color) { "The color is #{color}." } }, question_3: { prompt: "What is your favorite integer between 1 and 5?", choices: %w[1 2 3 4 5] } } answers = {} def simple_answer(question_hash) print question_hash[:prompt], " " gets.chomp end def multiple_choice_answer(question_hash) choices = question_hash[:choices] answer = nil until choices.include?(answer) print question_hash[:prompt], " " answer = gets.chomp puts "You must pick an answer from #{choices}" unless choices.include?(answer) end answer end QUIZ.each do |name, question_hash| answer = if question_hash[:choices] multiple_choice_answer(question_hash) else simple_answer(question_hash) end answers[name] = answer end display_answers = Hash[ answers.map do |name, answer| if display_proc = QUIZ[name][:...

Full article: http://pivotallabs.com/refactoring-the-deeply-nested-hash...

Tweets

I'm hiring UX and VxD--work on cool shit with a...

pivotallabs.com 25 Jan '13, 10pm

“What drives me: learning new things, perfecting my craft, working with smart and amazing people, and helping my clients s...

You can't replace your designer with Cucumber.

pivotallabs.com 26 Jan '13, 1pm

This is the first in a series of short posts explaining what Cucumber is and isn’t. Used correctly, Cucumber can be a tool...

Pivotal Labs NYC is looking for mobile develope...

pivotallabs.com 31 Jan '13, 5pm

Pivotal Labs: We Transform Ideas into Software. As a recognized leader in highly disciplined agile software development pr...