Coder Social home page Coder Social logo

sparsify-challenge's Introduction

Sparsify Challenge

Open to Cascadia Ruby 2013 attendees.

Nested-hash data structures are awesome, except that they are actually pretty terrible to deal with when it comes to most data-stores. Sparsify is a utility we use internally at Simply Measured that converts deeply-nested hashes into flat, separator-concatenated-key hashes, like this:

# Nested Hash:
{
  'id'          => '196302235',
  'screen_name' => '@cascadiaruby',
  'counts'      => {
    'followers'   => 527,
    'following'   => 322,
    'listed'      => 41,
    'statuses'    => 1022
  },
  'meta'        => {
    'updated_at'  => '2013-10-17T03:36:17Z',
    'created_at'  => '2010-09-28T20:21:29Z'
  }
}

# Sparse Hash:
{
  'id'                => '196302235',
  'screen_name'       => '@cascadiaruby',
  'counts.followers'  => 527,
  'counts.following'  => 322,
  'counts.listed'     => 41,
  'counts.statuses'   => 1022,
  'meta.updated_at'   => '2013-10-17T03:36:17Z',
  'meta.created_at'   => '2010-09-28T20:21:29Z'
}

The challenge is to build your own:

Begin with step-1:

  1. run rake step-1
  2. code until the specs pass (The spec itself also contains hints)
  3. commit your changes.

Once you complete step-1, you will advance to step-2 and repeat. Each step includes the specs for all previous steps to ensure you don't accidentally regress; there are currently 5 total steps.

Don't forget to commit after each step is complete. When you're done, push your branch up to github and submit a pull-request. We'll look through the results, score based on clarity, completeness, and style, and notify prize-winners by 17:00 PDT on Tuesday, October 22.

Good luck!

sparsify-challenge's People

Contributors

yaauie avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.