GithubHelp home page GithubHelp logo

bizgolf-ui's Introduction

Bizgolf-ui

A codegolf web interface using the Bizgolf library. See that library for more about what code golf capabilities are available.

Features

This web interface currently supports PHP 5.5 submissions only for any of the holes provided by Bizgolf. User registration and login is provided for user's submitting scores.

Homepage

The homepage includes a list of all the holes included for the hosted event and an overall scoreboard for the event.

Homepage

Holes

Each hole has its own page where the hole's requirements are specified, including:

  • a description of what is expected from the hole,
  • constraints on the hole including the name of the constant where input is optionally given and the trim that is applied to the result before validation,
  • and a sample program that passes the hole's validation and could be used as a basis for a solution or for local validation.

Also on the hole details page is a scoreboard including all of the users with passing submissions ordered by score with the shortest submissions first and a list of recent submissions, both passing and failing, including the lengths of the submissions.

Hole Details

Users

Each user has their own page with a list of their top submissions and a total score for them across all of the holes.

User Details

Submitting Files

When logged in, there is a form for uploading submissions on each hole's page.

Submitting Files

Submissions

When logged in, any references to the authenticated user's submissions becomes a link to view the submission details. This is particularly useful for failing submissions in order to track down what is not working.

Authenticated Hole Details

Here is an example failure, where the submitted file used a lowercase w where it should have used an uppercase W. Included on this page is:

  • the source code (including a raw form where it is NOT utf-8 encoded);
  • the output of the submission, the expected output, and the difference of the two;
  • the stderr output;
  • the value of the constant for the submission;
  • the exit status from executing the submission;
  • the length of the submission in bytes.

Submission Details

Requirements

The web interface is written in PHP and uses some features from PHP 5.4, so older versions of PHP will not work. Dependencies are managed using Composer. The Bizgolf library is the primary dependency and it depends on Docker.

For storing configuration and user data, Mongo is used. You will need to install the mongo pecl extension and configure Bizgolf-ui to point at a mongo database as described below.

The mcrypt PHP extension is also needed for the encrypted cookies.

Installation

Using composer the project can be installed, along with its php dependencies, using the below command:

composer create-project --stability=dev nubs/bizgolf-ui

Configuration

Two environment variables need to be set to configure the application. COOKIE_SECRET_KEY needs to be set to a private and secure string that is used to encrypt the cookies used to store user authentication. MONGOHQ_URL needs to be a url pointing to a mongo database, e.g. mongodb://user:[email protected]:10000/dbname.

Hosting

For testing, php's builtin webserver can work:

COOKIE_SECRET_KEY='your secret here' MONGOHQ_URL='mongodb://localhost:27017' php --server localhost:8000 --docroot public

A better setup for production hosting would be apache or nginx. For example, here is an apache virtual host config as an example:

<VirtualHost *:80>
    ServerName bizgolf
    DocumentRoot "/srv/http/bizgolf-ui/public"
    SetEnv COOKIE_SECRET_KEY "your secret here"
    SetEnv MONGOHQ_URL "mongodb://localhost:27017"
    <Directory "/srv/http/bizgolf-ui/public">
        Order Allow,Deny
        Allow from all
        FallbackResource /index.php
    </Directory>
</VirtualHost>

Contributing

Any changes, suggestions, or bug reports are welcome to be submitted on github. Pull requests are welcome!

License

bizgolf-ui is licensed under the MIT license. See LICENSE for the full license text.

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.