diff --git a/.jshintrc b/.jshintrc
deleted file mode 100644
index e33784d..0000000
--- a/.jshintrc
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "asi" : true,
- "laxbreak" : true,
- "bitwise" : true,
- "boss" : false,
- "curly" : true,
- "eqeqeq" : true,
- "eqnull" : false,
- "evil" : false,
- "expr" : false,
- "forin" : false,
- "immed" : true,
- "indent" : 2,
- "latedef" : true,
- "loopfunc" : false,
- "noarg" : true,
- "node" : true,
- "regexp" : true,
- "regexdash" : false,
- "strict" : false,
- "scripturl" : true,
- "shadow" : false,
- "supernew" : false,
- "sub" : true,
- "undef" : true,
- "white" : true,
- "browser" : true,
- "globals": { "$": true, "io": true, "Cookies": true }
-}
diff --git a/.travis.yml b/.travis.yml
index 06063d8..f6be9cb 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,6 @@
language: node_js
node_js:
- - 0.12
+ - 4
services:
- redis-server
env:
diff --git a/Procfile b/Procfile
deleted file mode 100644
index 4309650..0000000
--- a/Procfile
+++ /dev/null
@@ -1 +0,0 @@
-web node server.js
diff --git a/README.md b/README.md
index 4b3342e..07cbdf7 100644
--- a/README.md
+++ b/README.md
@@ -2,12 +2,12 @@
What if there was a *simple+easy* way to see how many people have viewed your GitHub Repository?
-[![Build Status](https://travis-ci.org/nelsonic/hits.svg)](https://travis-ci.org/nelsonic/hits)
+[![Build Status](https://travis-ci.org/dwyl/hits.svg)](https://travis-ci.org/dwyl/hits)
[![HitCount](https://hitt.herokuapp.com/nelsonic/hits.svg)](https://github.com/nelsonic/hits)
-[![Code Climate](https://codeclimate.com/github/nelsonic/hits/badges/gpa.svg)](https://codeclimate.com/github/nelsonic/hits)
-[![codecov.io](http://codecov.io/github/nelsonic/hits/coverage.svg?branch=master)](http://codecov.io/github/nelsonic/hits?branch=master)
-[![Dependency Status](https://david-dm.org/nelsonic/hits.svg)](https://david-dm.org/nelsonic/hits)
-[![devDependency Status](https://david-dm.org/nelsonic/hits/dev-status.svg)](https://david-dm.org/nelsonic/hits#info=devDependencies)
+[![Code Climate](https://codeclimate.com/github/dwyl/hits/badges/gpa.svg)](https://codeclimate.com/github/dwyl/hits)
+[![codecov.io](http://codecov.io/github/dwyl/hits/coverage.svg?branch=master)](http://codecov.io/github/dwyl/hits?branch=master)
+[![Dependency Status](https://david-dm.org/dwyl/hits.svg)](https://david-dm.org/dwyl/hits)
+[![devDependency Status](https://david-dm.org/dwyl/hits/dev-status.svg)](https://david-dm.org/dwyl/hits#info=devDependencies)
## Why?
@@ -23,7 +23,7 @@ to know where we need to be investing our time.
A simple way to add (*very basic*) analytics to your GitHub repos.
-There are already *many* "Badges" available which people put in their repos: https://github.com/dwyl/repo-badges
+There are already *many* "Badges" available which people put in their repos: https://github.com/dwyl/repo-badges
But we haven't seen one that gives a "***hit counter***"
of the number of times a page has been viewed ...
@@ -65,6 +65,25 @@ We then have a user-agent hash where we can lookup the by id:
Given that shields.io has a badge creation service,
and it has acceptable latency, we are proxying the their service.
+## Run it!
+
+Download (clone) the code to your local machine:
+```sh
+git clone https://github.com/dwyl/hits.git && cd hits
+```
+> Note: you will need to have Redis running on your localhost,
+> if you are new to Redis see: https://github.com/dwyl/learn-redis
+
+Install dependencies:
+```sh
+npm install
+```
+Run locally:
+```sh
+npm run dev
+```
+Visit: http://localhost:8000/any/url/count.svg
+
## Research
@@ -79,7 +98,7 @@ need to perform a lookup on each hit which requires network IO ...
(*expensive*!)
What if there was a way of *deriving* a `String` representation of the
the user-agent string ... oh, that's right, here's one I made earlier...
-https://github.com/ideaq/aguid
+https://github.com/dwyl/aguid
### Log Formats
diff --git a/image_50x50.png b/lib/1x1px.png
similarity index 82%
rename from image_50x50.png
rename to lib/1x1px.png
index 95e6148..e247364 100644
Binary files a/image_50x50.png and b/lib/1x1px.png differ
diff --git a/lib/client.js b/lib/client.js
new file mode 100644
index 0000000..c77deb0
--- /dev/null
+++ b/lib/client.js
@@ -0,0 +1,9 @@
+// connect to websocket server
+$( document ).ready(function() {
+ console.log('Ready!', window.location.host);
+ var socket = io(window.location.host);
+ socket.on('news', function (data) {
+ console.log(data);
+ socket.emit('my other event', { my: 'data' });
+ });
+});
diff --git a/lib/hits.js b/lib/hits.js
index c5ea879..7da52be 100644
--- a/lib/hits.js
+++ b/lib/hits.js
@@ -31,7 +31,7 @@ module.exports.add = function add (hit, callback) {
*/
module.exports.count = function count (url, callback) {
console.log(url);
- url = url.replace('https://github.com', ''); // don't waste RAM!
+ url = url.replace('https://github.com', ''); // don't waste space in Redis
redisClient.llen(url, function(err, data){
callback(err, data);
});
diff --git a/lib/index.html b/lib/index.html
new file mode 100644
index 0000000..e00c1da
--- /dev/null
+++ b/lib/index.html
@@ -0,0 +1,20 @@
+
+
+