Coder Social home page Coder Social logo

heimdall's Introduction

Heimdall

Please read all the instructions before starting this code challenge.

https://hexdocs.pm/phoenix/up_and_running.html

Visit this link for instructions on how to install Phoenix, Elixir, and the hard deps (Erland, Postgres, Node etc...) and get it running.

Challenge

Most products sold in retail have on them what's called a UPC-A barcode. UPC-A barcodes are a set of 12 digits. The first 11 digits are a product identifier while the last digit is what's called a check digit. The check digit exists to ensure that the barcode was generated correctly. Here's where the challenge begins.

We need our phoenix app to be able to generate a check digit so that our barcodes will work. Suppose that you want to find the check digit of UPC-A number 72641217542. From the right to the left, start with odd position, assign the odd/even position to each digit. Sum all digits in odd position and multiply the result by 3: (7+6+1+1+5+2)*3=66 Sum all digits in even position: (2+4+2+7+4)=19 Sum the results of step three and four: 66+19=85 Divide the result of step four by 10. The check digit is the number which adds the remainder to 10. In our case, divide 85 by 10 we get the remainder 5. The check digit then is the result of >10-5=5. If there is no remainder then the check digit equals zero. http://www.azalea.com/white-papers/upc-barcode-check-digit/

There are two routes you need to implement and one bug to fix. All the work will be done in the heimdall/lib/heimdall_web/controllers/api_controller.ex file.

Upon Completion

When finished, shoot us an email with the url of your forked repo.

If for any reason you don't want to fork the repo, you can clone the repo and when you're finished zip it up and email it to us.

Do Not

Do not submit a pull request to this repo.

Do not share your results with other applicants.

More Instructions & Resources

To start your Phoenix server:

  • Install dependencies with mix deps.get
  • Create and migrate your database with mix ecto.create && mix ecto.migrate
  • Install Node.js dependencies with cd assets && npm install
  • Start Phoenix endpoint with mix phx.server

Now you can visit localhost:4000 from your browser.

Ready to run in production? Please check our deployment guides.

Learn more

heimdall's People

Contributors

wilson-micah avatar hacklash avatar rholdy avatar

Watchers

 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.