Giter Site home page Giter Site logo

enums-exercises's Introduction

Enums Exercises

Fork and clone the enums-exercises repository.

$ cd ~/your/project/dir
$ git clone [email protected]:USERNAME/enums-exercises.git
$ cd enums-exercises

Create a branch so that you're not changing master:

$ git checkout -b make-tests-pass

The map Pattern

  1. exercises/map_pattern_test.rb
  2. exercises/map_test.rb

The select Pattern

  1. exercises/select_pattern_test.rb
  2. exercises/select_test.rb

The reject Pattern

  1. exercises/reject_pattern_test.rb
  2. exercises/reject_test.rb

The any? Pattern

  1. exercises/any_pattern_test.rb
  2. exercises/any_test.rb

The all? Pattern

  1. exercises/all_pattern_test.rb
  2. exercises/all_test.rb

The none? Pattern

  1. exercises/none_pattern_test.rb
  2. exercises/none_test.rb

The one? Pattern

  1. exercises/one_pattern_test.rb
  2. exercises/one_test.rb

The group_by Pattern

  1. exercises/group_by_pattern_test.rb
  2. exercises/group_by_test.rb

The find Pattern

  1. exercises/find_pattern_test.rb
  2. exercises/find_test.rb

The count Pattern

  1. exercises/count_pattern_test.rb
  2. exercises/count_test.rb

The sort_by Pattern

  1. exercises/sort_by_pattern_test.rb
  2. exercises/sort_by_test.rb

The reduce Pattern

  1. exercises/reduce_pattern_test.rb
  2. exercises/reduce_test.rb

The zip Pattern

  1. exercises/zip_pattern_test.rb
  2. exercises/zip_test.rb

Other exercises

  • exercises/find_using_max_by_test.rb
  • exercises/basic_enums_test.rb

Commit your changes:

$ git diff # to look at the changes
$ git add -A # to add everything if you like what you see
$ git commit -m "Make tests pass using Enumerable#each"

Create Your Own Adventure

Check out master:

$ git checkout master

Create a new branch:

$ git checkout -b new-exercises

Make up one extra test for each test suite. Remember to delete the implementation once it's passing, and add a skip to it.

$ git diff
$ git add -A
$ git commit -m "Add more exercises"

Push your branch up to GitHub:

$ git push -u origin new-exercises

Submit a pull request (go to the front page of your own enums-exercises repository, there should be a button to compare/create a pull request for the branch that you just pushed up).

Using Other Enumerable Methods

Now go back to your make-tests-pass branch:

$ git checkout make-tests-pass

We will use alternate Enumerable methods to solve the same problems as before:

  • map: transform_collections_test.rb
  • select: pick_desired_values_test.rb
  • reject: filter_unwanted_values_test.rb
  • any?: are_there_any_test.rb
  • all?: are_they_all_test.rb
  • find: find_first_one_test.rb

Keeping in sync with the upstream repository

origin is your fork of the project. We'll need to connect to the upstream repository.

To do this, add a new remote named upstream that points to the JumpstartLab:

$ git remote add upstream [email protected]:JumpstartLab/enums-exercises.git

Then pull down the updated version of upstream:

$ git fetch upstream

And now make sure you're on master:

$ git checkout master
$ git branch # should say *master

Make master point to the exact commit that upstream/master is pointing at:

$ git reset --hard upstream/master

License

The MIT License (MIT)

Copyright (c)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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.