Created
July 29, 2011 00:33
-
-
Save michilu/1112895 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html xmlns:og="http://ogp.me/ns#" xmlns:fb="http://www.facebook.com/2008/fbml"> | |
{% if number %} | |
{% set results = [results[number-1]] %} | |
{% set title = results[0].title + " - " %} | |
{% set lang = results[0].lang %} | |
{% set ogtype = "article" %} | |
{% set ogurl = "/" + number.__str__() %} | |
{% endif %} | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="width=1000" /> | |
<meta name="author" content="MiCHiLU Labs."> | |
<title>{{ title }}PyCon JP 2011 投票</title> | |
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"> | |
<link rel="icon" href="/favicon.ico" type="image/ico"> | |
<link rel="apple-touch-icon" href="/favicon.ico"> | |
<link rel="alternate" type="application/rss+xml" title="PyCon JP 2011 Call for Paper" href="https://spreadsheets.google.com/feeds/list/0Aqk3uAT_XDuZdHlUSjJiMVdhTjJiX2lIUUY3M1FMZ2c/od6/public/basic?alt=rss" /> | |
<link href="/media/stylesheets/style.css" rel="stylesheet" type="text/css" /> | |
<link href="/media/stylesheets/smartphone.css" rel="stylesheet" type="text/css" media="only screen and (max-device-width:480px)" /> | |
<script src="http://www.google.com/jsapi"></script> | |
<script type="text/javascript"> | |
google.load("visualization", "1"); | |
</script> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script> | |
<script src="http://s.hatena.ne.jp/js/HatenaStar.js"></script> | |
<script type="text/javascript" src="http://apis.google.com/js/plusone.js"> | |
{lang: 'ja'} | |
</script> | |
<script src="http://github.com/cho45/jsdeferred/raw/master/jsdeferred.js"></script> | |
<script src="/media/scripts/main.js"></script> | |
<meta property="og:image" content="http://2011.pyconjp.appspot.com/media/images/thumbnail.png"> | |
<meta property="og:site_name" content="{{ title }}PyCon JP 2011 投票"> | |
<meta property="og:title" content="{{ title }}PyCon JP 2011 投票"> | |
<meta property="og:type" content="{{ ogtype or 'website' }}"> | |
<meta property="og:url" content="http://2011.pyconjp.appspot.com/cfp{{ ogurl }}"> | |
<meta property="fb:app_id" content="205947526113021" /> | |
<script type="text/javascript"> | |
var _gaq = _gaq || []; | |
_gaq.push(['_setAccount', 'UA-23751855-2']); | |
_gaq.push(['_setDomainName', '.pyconjp.appspot.com']); | |
_gaq.push(['_trackPageview']); | |
(function() { | |
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | |
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | |
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); | |
})(); | |
</script> | |
</head> | |
<body> | |
<div id="section"> | |
<h1><a href="/cfp">PyCon JP 2011 Call for Paper</a></h1> | |
<!-- Google Translate Element --> | |
<div id="google_translate_element" style="display:block"></div><script> | |
function googleTranslateElementInit() { | |
new google.translate.TranslateElement({pageLanguage: "{{ lang or 'ja' }}"}, "google_translate_element"); | |
};</script> | |
<script src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script> | |
<div class="share"> | |
<div class="follow"> | |
<a href="http://twitter.com/pyconj" class="twitter-follow-button" data-lang="ja">Follow @pyconj</a> | |
<script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script> | |
</div> | |
<div class="tweet"> | |
<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://2011.pyconjp.appspot.com/cfp" data-text="PyCon JP 2011 投票 via @pyconj #pyconjp" data-count="horizontal" data-lang="ja">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script> | |
</div> | |
<div class="mixi"> | |
<iframe scrolling="no" frameborder="0" allowTransparency="true" style="overflow:hidden; border:0; width:100px; height:80px" src="http://plugins.mixi.jp/favorite.pl?href=http%3A%2F%2F2011.pyconjp.appspot.com%2fcfp&service_key=60f8ff55ee86ec371dfe0e424bf0a1e1ceea85f8&show_faces=true&width=100" data-button="button-5"></iframe> | |
</div> | |
<div class="like"> | |
<iframe src="http://www.facebook.com/plugins/like.php?app_id=107935725962744&href=http%3A%2F%2F2011.pyconjp.appspot.com%2Fcfp&send=false&layout=standard&width=450&show_faces=true&action=like&colorscheme=light&font=arial&height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe> | |
</div> | |
</div> | |
<p>エントリーの一覧です。聞いてみたいセッションに投票してみましょう。投票したいタイトル下の「はてなスター」「+1」「ツイートする」「イイネ!」「いいね!」アイコンをクリック!知人にも投票してもらいましょう。<a href="http://www.google.com/moderator/#16/e=85569">こんなセッションが聞きたい!というリクエストは〈こちら〉から。</a><a href="http://2011.pycon.jp/cfp/form">CFPの発表をしたい方は〈こちら〉から登録。</a><a href="https://spreadsheets.google.com/spreadsheet/pub?key=0Aqk3uAT_XDuZdHlUSjJiMVdhTjJiX2lIUUY3M1FMZ2c">CFPのエントリー情報の一部を〈公開〉しています。マッシュアップ歓迎!</a><a href="https://spreadsheets.google.com/feeds/list/0Aqk3uAT_XDuZdHlUSjJiMVdhTjJiX2lIUUY3M1FMZ2c/od6/public/basic?alt=rss">〈RSS〉</a><a href="http://2011.pycon.jp/">PyCon JP 2011公式サイトは〈こちら〉。</a></p> | |
<ol id="result"> | |
{% for entry in results %} | |
<li id="{{ entry.number }}"> | |
<div class="number"><a href="/cfp#{{ entry.number }}">#{{ entry.number }}</a></div> | |
<div class="title"> | |
<a href="/cfp/{{ entry.number }}">{{ entry.title}}</a> | |
</div> | |
<div class="share"> | |
<div class="star"></div> | |
<div class="g-plusone" data-href="http://2011.pyconjp.appspot.com/cfp/{{ entry.number }}"></div> | |
<div class="tweet"> | |
<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://2011.pyconjp.appspot.com/cfp/{{ entry.number }}" data-text="{{ entry.title }} - PyCon JP 2011 投票 /via @pyconj #pyconjp" data-count="horizontal" data-lang="ja">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script> | |
</div> | |
<div class="mixi"> | |
<iframe scrolling="no" frameborder="0" allowTransparency="true" style="overflow:hidden; border:0; width:100px; height:80px" src="http://plugins.mixi.jp/favorite.pl?href=http%3A%2F%2F2011.pyconjp.appspot.com%2fcfp%2f{{ entry.number }}&service_key=60f8ff55ee86ec371dfe0e424bf0a1e1ceea85f8&show_faces=true&width=100" data-button="button-5"></iframe> | |
</div> | |
<div class="like"> | |
<iframe src="http://www.facebook.com/plugins/like.php?app_id=107935725962744&href=http%3A%2F%2F2011.pyconjp.appspot.com%2fcfp%2f{{ entry.number }}&send=false&layout=standard&width=450&show_faces=true&action=like&colorscheme=light&font=arial&height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe> | |
</div> | |
</div> | |
<ul> | |
{% if number %}<description>{% endif %} | |
<li>{{ entry.abstract }}</li> | |
<li>{{ entry.outline|replace("\n", "<br />")|safe }}</li> | |
{% if number %}</description>{% endif %} | |
</ul> | |
</li> | |
{% endfor %} | |
</ol> | |
{% if number %} | |
<div id="next"> | |
<div> | |
<a href="/cfp#{{ number + 1 }}">次のエントリーへ</a> | |
</div> | |
</div> | |
{% endif %} | |
</div> | |
<div id="footer"> | |
<a href="http://michilu.com/contacts">created by MiCHiLU Labs.</a> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hatenaStar = () -> | |
Hatena.Star.Token = '9bbd09a2638cda5656d8ce7542c3b99aa91a3a08' | |
c = Hatena.Star.EntryLoader | |
c.entries = [] | |
for element in $("#result > li") | |
entry = new Hatena.Star.Entry | |
uri: "http://2011.pyconjp.appspot.com/cfp/"+$(element).attr("id") | |
title: $('div.title a', element).text() | |
star_container: $('.star', element).get(0) | |
entry.showButtons() | |
c.entries.push(entry) | |
c.getStarEntries() | |
return true | |
deferrs = () -> | |
Deferred.parallel [ | |
Deferred.call hatenaStar | |
] | |
wait = (flag, callback) -> | |
_wait = setInterval () -> | |
if flag() | |
callback() | |
clearInterval _wait | |
, 1000 | |
wait () -> | |
return $("#result") | |
, deferrs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var deferrs, hatenaStar, wait; | |
hatenaStar = function() { | |
var c, element, entry, _i, _len, _ref; | |
Hatena.Star.Token = '9bbd09a2638cda5656d8ce7542c3b99aa91a3a08'; | |
c = Hatena.Star.EntryLoader; | |
c.entries = []; | |
_ref = $("#result > li"); | |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | |
element = _ref[_i]; | |
entry = new Hatena.Star.Entry({ | |
uri: "http://2011.pyconjp.appspot.com/cfp/" + $(element).attr("id"), | |
title: $('div.title a', element).text(), | |
star_container: $('.star', element).get(0) | |
}); | |
entry.showButtons(); | |
c.entries.push(entry); | |
} | |
c.getStarEntries(); | |
return true; | |
}; | |
deferrs = function() { | |
return Deferred.parallel([Deferred.call(hatenaStar)]); | |
}; | |
wait = function(flag, callback) { | |
var _wait; | |
return _wait = setInterval(function() { | |
if (flag()) { | |
callback(); | |
return clearInterval(_wait); | |
} | |
}, 1000); | |
}; | |
wait(function() { | |
return $("#result"); | |
}, deferrs); | |
}).call(this); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from kay.routing import ( | |
ViewGroup, Rule | |
) | |
view_groups = [ | |
ViewGroup( | |
Rule('/cfp', endpoint='cfp', view='main.views.cfp'), | |
Rule('/cfp/<int:number>', endpoint='cfp', view='main.views.cfp'), | |
) | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from StringIO import StringIO | |
import csv | |
import sys | |
from google.appengine.api import ( | |
memcache, | |
urlfetch, | |
) | |
from google.appengine.api.urlfetch_errors import SSLCertificateError | |
from werkzeug.exceptions import ( | |
InternalServerError, | |
) | |
from kay.utils import ( | |
render_to_response | |
) | |
stdin = sys.stdin | |
stdout = sys.stdout | |
reload(sys) | |
sys.setdefaultencoding('utf-8') | |
sys.stdin = stdin | |
sys.stdout = stdout | |
def cfp(request, number=None): | |
ns = "2011_cfp" | |
results = memcache.get("cfps", namespace=ns) | |
if not results: | |
resource = "https://spreadsheets0.google.com/spreadsheet/pub?key=0Aqk3uAT_XDuZdHlUSjJiMVdhTjJiX2lIUUY3M1FMZ2c&output=csv" | |
try: | |
result = urlfetch.fetch(resource) | |
except SSLCertificateError: | |
raise InternalServerError | |
results = dict() | |
if result.status_code == 200: | |
first = True | |
for row in csv.reader(StringIO(result.content)): | |
if first: | |
first = False | |
continue | |
result = dict(zip((u"number", u"title", u"abstract", u"outline", u"lang"), row[:5])) | |
results[int(result["number"])] = result | |
memcache.set_multi(dict( | |
count = len(results), | |
cfps = results, | |
), time=3600, namespace=ns) | |
results = [results[key] for key in range(1, len(results)+1)] | |
return render_to_response('main/cfp.html', vars()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment