forked from clojure/clojurescript
-
Notifications
You must be signed in to change notification settings - Fork 15
Demo Application
brentonashworth edited this page Jul 19, 2011
·
15 revisions
Goal: Show off ClojureScript. Pull in tweets on a certain hashtag and organizing them in a meaningful way by discovering things about the tweets based on the content.
Features:
- Build a network of people who tweet on a certain topic
- Each node could be the twitter avatar
- Nodes could be related (draw a line between?) if there is a mention or a retweet
- Nodes could grow in size based on number of connections?
- Sidebar with most popular tweets
- Show the five most popular tweets based on retweets/mentions
- Show history of the data
- Display a timeline along the bottom
- Scrub the timeline backwards to show each tweet as it is added
Tweets are a vector of maps. Vector will probably most likely maybe not never be not empty.
[{:from_user_id_str "386967"
:profile_image_url "http://a2.twimg.com/profile_images/53769404/spiral_normal.jpg"
:created_at "Fri, 15 Jul 2011 20:18:02 +0000"
:from_user "ajlopez"
:id_str "91964762916790272"
:metadata {"result_type" "recent"}
:to_user_id nil
:text "The Clojure Daily is out! http://bit.ly/hZ7PWT \u25b8 Top stories today via @berngp @jneira @rrjanbiah @kazu_yamamoto @leontalbot"
:id 91964762916790272
:from_user_id 386967
:geo nil
:iso_language_code "en"
:to_user_id_str nil
:source "<a href="http://paper.li" rel="nofollow">Paper.li</a>"}
{:from_user_id_str "94383535"
:profile_image_url "http://a0.twimg.com/profile_images/672298480/6491_528444835196_4500150_31295637_2251323_n_normal.jpg"
:created_at "Fri, 15 Jul 2011 19:37:37 +0000"
:from_user "ahillelt"
:id_str "91954592115462144"
:metadata {"result_type" "recent"}
:to_user_id nil
:text "For all you Ruby fans out there, Matz has joined Heroku, a Ruby Cloud Hosting Company. Plus Heroku now supports Clojure apps in it's cloud."
:id 91954592115462144
:from_user_id 94383535
:geo nil
:iso_language_code "en"
:to_user_id_str nil
:source "<a href="http://twitter.com/">web</a>"}]
There are some great demos with lots of sample code in closure/library/closure/goog/demos
- closure/library/closure/goog/demos/index.html
- Of interest to us
- closure/library/closure/goog/demos/quadtree.html
- How to pull in tweets?
-
goog.net.Jsonp
- We pull in tweets, remember the last one we saw, and call somebody's function with data if we see anything new
- agents would be nice for this
- timeline?
- atom + our own timeline data structure
- tweet consumer/plugin responsibility to store historical data?
- timeline?
- agents would be nice for this
-
- update base layout, add timeline column
- in a separate namespace: twitterbuzz.timeline
- register a function to get new tweets
- when it gets new tweets, it adds them to the top of an
ul
asli
- it removes the last n tweets as necessary
- when it gets new tweets, it adds them to the top of an
- register a function to get new tweets
- show relationship between users and the users that retweet/mention them
- in the search.json data, we don't have "retweets" or "mentions"
- we infer it from the text of the tweet
- in the search.json data, we don't have "retweets" or "mentions"
- use the new
js->clj
that Stuart S. just added - change all
loop/recur
to usedoseq
- supports the 'leaderboard' view
- supports a 'graph' view
- consumer registers to receive data as we have it
- we groom new tweet data into the graph data for them
{"bob"
{:image-url "http://a0.twimg.com/profile_images/2251323_n_normal.jpg"
:mentions {"sally" 3 "joe" 2}
:last-tweet "Clojure on JavaScript. Wow!"
:last-person-mentioned "ron"}
"susan"
{:image-url "http://a0.twimg.com/profile_images/2251323_n_normal.jpg"
:mentions {"joe" 5}
:last-tweet "ClojureScript doesn't have TCO! I'll never use it."
:last-person-mentioned "joe"}}
- leverages graph data structure
- registers a function that gets a new graph data structure when it's updated
- sort by :num_mentions and populate a
ul
with up to n elements
- leverages graph data structure
- registers a function that gets a new graph data structure when it's updated