Skip to content

Commit

Permalink
The code and README
Browse files Browse the repository at this point in the history
  • Loading branch information
Seva Rybakov committed Apr 4, 2013
0 parents commit d50a223
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# github-zen: A tiny utility for reading github zen
A tiny piece of javascript for watching zen streaming from GitHub API

## Installation

- Install node.js;
- Clone the repo;
- ```$ npm install```;
- ```$ node zen.js```;
- Watch it.
15 changes: 15 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "github-zen",
"version": "1.0.0",
"description": "Fetches github zen citations from https://api.github.com/zen and... well, may ban you for a while",
"main": "zen.js",
"repository": "http://github.com/CodingFu/github-zen",
"keywords": [
"strange"
],
"author": "Seva Rybakov",
"dependencies": {
"underscore": "~1.4.4",
"request": "~2.16.6"
}
}
18 changes: 18 additions & 0 deletions zen.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
var request = require('request')
, _ = require('underscore')
, messages = []
, limit = 10000
, i = 0;

function getZen() {
request('https://api.github.com/zen', function(err, res, body) {
if (err || res.statusCode === 403 || i === limit) { return; }
if (!_.include(messages, body)) {
messages.push(body);
console.log(body);
}
setTimeout(getZen, 300);
});
}

getZen();

0 comments on commit d50a223

Please sign in to comment.