Code Monkey home page Code Monkey logo

code-competition's Introduction

This solution's metrics -- irrelevant, it's JavaScript. Strictly JSLint-ed though :)

Code beauty contest

XIAG is running the first Code Beauty Contest to encourage a good coding style.

Rules

  • A participant must have a GitHub account
  • Forking this repository declares the contest participation
  • Your code must pass ./acceptance_test.php; please replace the doTest() function to invoke your own implementation
  • Test coverage is calculated by PHPUnit; the tests must reside in ./test
  • The solutions' beauty is rated based on an open voting, and on the formal metrics provided by Scrutinizer -- the participants have to enable their repositories at scrutinizer-ci, and update the metrics links in this document
  • Any GitHub users can vote by starring the participant's repository

Installation

vagrant up && vagrant ssh

composer install --dev
./acceptance_test.php
./vendor/bin/phpunit

Problem

Implement a rows list pagination navigator

Input:

  • $offset index of the first displayed row
  • $total total amount of rows in the list
  • $rowsPerPage maximum page size
  • $maxNavigatorSize how many page numbers the navigator should display

Output:

A string of text with page numbers, where the current page is wrapped into square brackets:

3 4 [5] 6 7

Voting

After the problem is solved, the participant makes a pull request. The solutions are accessible for voting in the pull requests list.

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.