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
>>> str(Ellipsis) | |
'Ellipsis' | |
>>> str(pass) | |
File "<stdin>", line 1 | |
str(pass) | |
^ | |
SyntaxError: invalid syntax |
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
gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git', :branch => 'bootstrap3' |
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
#-*- encoding: utf-8 -*- | |
# thirdlib | |
import requests | |
BASE_URL = "http://en.wikipedia.org/w/api.php" | |
BLLIMIT = 250 | |
def get_regular_name(q): |
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 -*- | |
def shorten(s, length=80): | |
u""" | |
長い文字列を"abraca ... tabra"のように短く表示 | |
""" | |
if len(s) < length: | |
return s | |
else: | |
if isinstance(s, unicode): |
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 -*- | |
# third-party lib | |
import networkx | |
def blank_split(text): | |
u""" | |
半角スペースによる単語分割 | |
""" | |
return text.split() |
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 -*- | |
# stdlib | |
import re | |
LEFT_SPACES = re.compile(r'\s+<') | |
RIGHT_SPACES = re.compile(r'>\s+') | |
SCRIPT_TAG = re.compile(r'<script[^>]*>.*?</script>') | |
COMMENT = re.compile(r'<!--[\s\S]*?-->') |
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 -*- | |
# stdlib | |
import sys | |
import traceback | |
def print_exception(func, log_file=sys.stderr): | |
u""" | |
関数実行中に発生した例外を出力 | |
""" |
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 -*- | |
# stdlib | |
import re | |
import datetime | |
# thirdlib | |
from dateutil.parser import parse | |
MONTHS = ( | |
"January", | |
"February", |
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 -*- | |
# stdlib | |
import cPickle as pickle | |
import zlib | |
PROTOCOL = pickle.HIGHEST_PROTOCOL | |
def save_to_str(obj): |
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
sql_stmt = "CREATE TABLE Test(" \ | |
"id INTEGER PRIMARY KEY, " \ | |
"val TEXT NOT NULL)" |