Creates repository for twiderboard client side

This commit is contained in:
Julien Lengrand-Lambert
2013-02-03 18:00:12 +00:00
commit bf0fe3bd14
9 changed files with 384 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
*.pyc

12
flask_app.py Normal file
View File

@@ -0,0 +1,12 @@
# A very simple Flask Hello World app for you to get started with...
from flask import Flask
from flask import render_template
app = Flask(__name__)
@app.route('/')
def hello_world(name=None):
#return 'Hello from Flask!'
return render_template('-static/leader.html', name=name)

0
static/README Normal file
View File

26
static/index.html Normal file
View File

@@ -0,0 +1,26 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<!-- Using Google CDN -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script>
(function worker() {
$.ajax({
url : 'http://jlengrand.pythonanywhere.com/static/leader.html?rand='+Math.random(),
success: function(data) {
$('.text').html(data);
},
complete: function() {
setTimeout(worker, 1000);
}
});
})();
</script>
</head>
<body>
<div class="text">
To be loaded <br />
</div>
</body>
</html>

4
static/jquery.js vendored Normal file

File diff suppressed because one or more lines are too long

290
static/leader.html Normal file
View File

@@ -0,0 +1,290 @@
<h1>My leaderboard<h1>
<h2>#iamsowonderful<h2>
<table border="1">
</table>
<h2>#tf<h2>
<table border="1">
<tr>
<td>1</td>
<td>ulan_machf</td>
<td>93</td>
</tr>
<tr>
<td>2</td>
<td>AyuLSR</td>
<td>87</td>
</tr>
<tr>
<td>3</td>
<td>dhitahartonoput</td>
<td>81</td>
</tr>
<tr>
<td>4</td>
<td>LOL_TF_kor</td>
<td>60</td>
</tr>
<tr>
<td>5</td>
<td>widya_bakti</td>
<td>59</td>
</tr>
<tr>
<td>6</td>
<td>TimelineFRONTAL</td>
<td>58</td>
</tr>
<tr>
<td>7</td>
<td>arlla11</td>
<td>56</td>
</tr>
<tr>
<td>8</td>
<td>ArizalSiregar</td>
<td>51</td>
</tr>
<tr>
<td>9</td>
<td>fryAmfir</td>
<td>48</td>
</tr>
<tr>
<td>10</td>
<td>AniendhitaCitra</td>
<td>47</td>
</tr>
</table>
<h2>#spacemetric<h2>
<table border="1">
<tr>
<td>1</td>
<td>jlengrand</td>
<td>5</td>
</tr>
</table>
<h2>#twitter<h2>
<table border="1">
<tr>
<td>1</td>
<td>LifeHackEX</td>
<td>455</td>
</tr>
<tr>
<td>2</td>
<td>JulienLanger</td>
<td>416</td>
</tr>
<tr>
<td>3</td>
<td>JeromeSimon</td>
<td>328</td>
</tr>
<tr>
<td>4</td>
<td>_DJBALA</td>
<td>279</td>
</tr>
<tr>
<td>5</td>
<td>navermatomenews</td>
<td>235</td>
</tr>
<tr>
<td>6</td>
<td>ers_110</td>
<td>219</td>
</tr>
<tr>
<td>7</td>
<td>explosaodofunk</td>
<td>213</td>
</tr>
<tr>
<td>8</td>
<td>SocialNewsCorp</td>
<td>196</td>
</tr>
<tr>
<td>9</td>
<td>Memarketgroup</td>
<td>180</td>
</tr>
<tr>
<td>10</td>
<td>seo1302</td>
<td>168</td>
</tr>
</table>
<h2>#wtf<h2>
<table border="1">
<tr>
<td>1</td>
<td>notinsolito</td>
<td>197</td>
</tr>
<tr>
<td>2</td>
<td>TKDSL1</td>
<td>158</td>
</tr>
<tr>
<td>3</td>
<td>ROFLpalace</td>
<td>135</td>
</tr>
<tr>
<td>4</td>
<td>crazywtf</td>
<td>63</td>
</tr>
<tr>
<td>5</td>
<td>OMGVideoz</td>
<td>56</td>
</tr>
<tr>
<td>6</td>
<td>WTFThoughtss</td>
<td>49</td>
</tr>
<tr>
<td>7</td>
<td>JoshuaLandin</td>
<td>37</td>
</tr>
<tr>
<td>8</td>
<td>WTFConcertProbs</td>
<td>34</td>
</tr>
<tr>
<td>9</td>
<td>ZebraDetox</td>
<td>26</td>
</tr>
<tr>
<td>10</td>
<td>ResidentPalo</td>
<td>16</td>
</tr>
</table>
<h2>#nowplaying<h2>
<table border="1">
<tr>
<td>1</td>
<td>ekrnetwork</td>
<td>2578</td>
</tr>
<tr>
<td>2</td>
<td>NowBlasting</td>
<td>1645</td>
</tr>
<tr>
<td>3</td>
<td>RVLTMe</td>
<td>1534</td>
</tr>
<tr>
<td>4</td>
<td>radiorockcafe</td>
<td>1226</td>
</tr>
<tr>
<td>5</td>
<td>BPRNet</td>
<td>1160</td>
</tr>
<tr>
<td>6</td>
<td>FebreMania</td>
<td>1079</td>
</tr>
<tr>
<td>7</td>
<td>OnChristianRock</td>
<td>1045</td>
</tr>
<tr>
<td>8</td>
<td>indiepoprocks</td>
<td>1043</td>
</tr>
<tr>
<td>9</td>
<td>markhjacobs</td>
<td>1021</td>
</tr>
<tr>
<td>10</td>
<td>allplaying</td>
<td>1009</td>
</tr>
</table>

19
static/leader.py Normal file
View File

@@ -0,0 +1,19 @@
#!/usr/bin/python
from time import sleep
filename = "leader.html"
cpt = 0
def increment():
global cpt
myfile = open(filename, 'w')
myfile.write("%d" % (cpt))
cpt += 1
myfile.close()
while True:
increment()
sleep(1)

16
static/tmpl.html Normal file
View File

@@ -0,0 +1,16 @@
<h1>My leaderboard<h1>
{% for hashtags, members in items %}
<h2>{{hashtags}}<h2>
<table border="1">
{% for rank, author, count in members %}
<tr>
<td>{{rank}}</td>
<td>{{author}}</td>
<td>{{count}}</td>
</tr>
{% endfor %}
</table>
{% endfor %}

16
tmpl.html Normal file
View File

@@ -0,0 +1,16 @@
<h1>Twitter leaderboard<h1>
{% for hashtags, members in items %}
<h2>{{hashtags}}<h2>
<table border="1">
{% for rank, author, count in members %}
<tr>
<td>{{rank}}</td>
<td>{{author}}</td>
<td>{{count}}</td>
</tr>
{% endfor %}
</table>
{% endfor %}