Coder Social home page Coder Social logo

voting's Introduction

Voting

Code Climate

The voting application for Hackers, built using PHP 7, Laravel 5.1, and PostgreSQL.

Warning: This code has not been reviewed by anyone. It has no unit tests (yet).

Setup

You'll need Composer to get started. Once you have that, it's a matter of cloning the repository, installing the dependencies, and setting up the database.

git clone https://github.com/wearehx/voting hx-voting && cd hx-voting
composer install
cp .env.example .env && $EDITOR .env # http://laravel.com/docs/5.1/database#configuration
php artisan migrate
php artisan serve

Facebook Login

The application authenticates users via Facebook Login. You'll need to create an application and set the appropriate values. Additionally, you should setup a webhook to {url}/webhook/user on name and email changes. Set the verify token you define in FACEBOOK_VERIFY_TOKEN. You also need to ensure your callback URL ({url}/auth/facebook/callback) is whitelisted for your application.

Environment Variables

You'll need to set the following environment variables in .env if not set in the web server's environment:

  • APP_KEY: A random, 32 character string you can generate with php artisan key:generate.
  • FACEBOOK_APP_ID
  • FACEBOOK_APP_SECRET
  • FACEBOOK_CALLBACK_URL: The URL of your application, followed by /auth/facebook/callback (ex. https://test.ian.sh/auth/facebook/callback).
  • FACEBOOK_VERIFY_TOKEN: The verify token you set when creating the webhook.
  • NUM_ADMINS: The number of admins to be elected.

Term Setup

Ensure you have migrated the database with php artisan migrate before proceeding.

To create the first term, you will need to backdate a previous term by running php artisan term:create year month day. Since terms are three months long, you want to take the date you want the next term to start on and subtract three months. Then, input that date as the three arguments to the command (if the next term should start on 12/19/2015, run php artisan term:create 2015 9 19). You then need to create your next term with the same command, but without subtracting three months (with the same example, the command would be php artisan term:create 2015 12 19).

New terms will automatically be created after this, assuming the scheduler is properly setup.

Heroku Scheduler

If the application is running on Heroku, add the Scheduler addon and set the command php artisan schedule:run to run every ten minutes.

Contributing

You'll need to npm install our build dependencies and run gulp --production if you modify the SASS stylesheet. Changes can be proposed in a PR with a clear purpose and clear commit messages. Do note that merging into this repository is frozen during elections (two weeks from the next term's start date) except for security and critical bug fixes.

Additionally, you should read contributing.md and todo.md.

voting's People

Contributors

iangcarroll avatar gsingh93 avatar sckelemen avatar

Stargazers

Sara Souza avatar

Watchers

James Cloos avatar Léo Moraes avatar  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.