A gamification of electricity meter readings for the energy sector. Code provided by ElinorCrew for #PowerHack2014. Visit the live demo at kraftkamp.no.
This repository contains express.js, underscore.js and logfmt. On the client-side, knockout.js, underscore.js and d3.js are pulled directly from CDN. Bootstrap css is added to /public/style.
d3.js and knockout are used together to create interesting and reusable graphs to present electricity consumption data.
Some links from Demo Steinkjer:
Requirements:
- Node
Clone source into a folder and then install dependencies with:
npm install
Launch the site at localhost with:
npm start
Visit localhost:1704 to see the main page and localhost:1704/json to get the JSON example.
The following guides are for newer versions of Ubuntu, although links to more general instructions can be found.
This is a brief summary of howtonode.org, but with the updated location of the node git repository. For the most up to date installation guide, refer to the nodejs.org homepage.
Install the dependencies:
sudo apt-get install g++ curl libssl-dev apache2-utils
sudo apt-get install git-core
Clone and build from source with:
git clone [email protected]:joyent/node.git
cd node
./configure
make
sudo make install
Get a version of jslint for your text editor and remove all errors before committing. If not you'll get a nasty visit from @teodoran. Check jslinterrors for more info on individual error messages.
Server-side code and npm dependencies are located in the root folder. Client-side code are located in the /public folder.
- Server.js contains the Node server code. It uses express.js.
- /public/index.html is the main webpage served.
- /public/app.js contains the code responsible for bootstrapping the javascript code on the client-side.
- /public/achievements contains the code for the achievement module.
- /public/highscore contains code for displaying highscores.
- /json-provider.js provides JSON objects.
First install the Heroku toolbelt.
Then you have to navigate to the project folder and link the git repository to the Heroku deployment server using:
git remote add heroku [email protected]:power-hack.git
Now you can deploy the site to heroku with:
git push heroku master
Since time is in short supply, the page is rolled without much tests. When needed mocha specs are written and placed in the /spec folder. To install mocha and the should.js assertion library, install the development dependencies with npm. Run all tests with npm test
.
For the sake of simplicity, mocha is currently only set up to run server-side tests.
- Teodor A. Elstad (http://twitter.com/_teodoran)
- Simen H. Granlund (http://twitter.com/simengranlund)
- Magnus Kirø (http://twitter.com/magnuskiro)
- George Lee (http://twitter.com/georgekw89)
- Steffen P. Henriksen (http://twitter.com/spohner)