A reader for tldr.io written in meteor.js
This repository has been archived on 2026-09-29. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
  • JavaScript 64.7%
  • HTML 33.5%
  • CSS 1.8%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2013-04-07 00:09:48 -05:00
.meteor language filter created 2013-04-05 03:12:46 -05:00
client html update 2013-04-05 04:44:29 -05:00
lib/tldrapi updated gui! 2013-04-05 01:26:19 -05:00
server updated gui! 2013-04-05 01:26:19 -05:00
shared cheated the client for deploy 2013-04-05 03:27:19 -05:00
.gitignore added git ignore for sublime files 2013-04-07 00:09:48 -05:00
app.css language filter created 2013-04-05 03:12:46 -05:00
readme.md cheated the client for deploy 2013-04-05 03:27:19 -05:00

Running Demo @ http://tldreader.meteor.com/

Please don't spam the red button! It sends an http request to tldr.io and caches the results in mongo. Spamming it won't give you new data.

How to setup

Disclaimer: This probably won't work. Don't throw things at me if it doesn't

  • install meteor
  • clone the repo
  • run meteor
  • navigate to app
  • run get_data() in the console

Log:

Installed meteor

created meteor app

meteor create tldr
mkdir client lib public server shared

Added Meteor components

meteor add accounts-ui accounts-password bootstrap jquery

Removed Meteor components

meteor remove autopublish

cloned my repo of the js client

cd lib/
git clone https://github.com/jhgaylor/api-js-client.git

created the tldrs collection

in shared/bootstrap.js

Tldrs = Meteor.collection('tldrs')

This gives access to the collection to both the server and the client

Published the tldrs collection

in server/bootstrap.js

Meteor.publish('tldrs', function () {
    return Tldrs.find();
})

This allows subscribers to access the collection. For now I want all the records available to my client.

Subscribed the client to the tldrs collection

in client/app.js

Meteor.subscribe('tldrs');

This will tell the client to listen for changes to tldrs

exposed the client

For now I am exposing the TLDR api client to both the server and client, but I won't be programming the client to use the TLDR api client. It's just for access via the chrome console

c = new Client({
    name: "name",
    key: "key"
});

Get some data!

I needed some TLDR's to start creating the UI with, so I got some! Here is the helper i used

function get_data () {
    c.getLatestTldrs(10, function(e, data){
        data.forEach(function (item) {
            TLDRS.insert(item)
        })
    });
}

I then called the method via the console. Now I have 10 data points to start working on a ui. My app doesn't have any need to restructure the data provided by TLDR. All the server side work will be keep state synced and make requests to tldr.io

Added custom field readBy

I added a field to each tldr record i get to keep track of which users have read the article. I did this by modifying my helper function

function get_data () {
    client.getLatestTldrs(10, function(e, data){
        data.forEach(function (item) {
            item.readBy = item.readyBy || {}
            Tldrs.insert(item)
        })
    });
}

Admire the magic

Mongo accepted the tldr id as the pk automatically and won't insert duplicate tl;dr items. Booyah!