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
#-*- 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
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
$ pip install rstr |
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
>>> c1 = 1 + 1j | |
>>> c2 = 1 - 2j | |
>>> c1 + c2 | |
(2-1j) | |
>>> c1 * c2 | |
(3-1j) | |
>>> c1 / c2 | |
(-0.2+0.6j) |
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
import re | |
import sqlite3 | |
class SQLite3DB: | |
_IDENTIFIER_RE = re.compile(r'^[a-zA-Z_]\w*$') | |
def __init__(self, filename): | |
self._con = sqlite3.connect(filename, isolation_level=None) | |
self._con.row_factory = sqlite3.Row |
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
identifier: | |
guid: "129961" | |
fileName: "0129961.xml" | |
url: "http://query.nytimes.com/gst/fullpage.html?res=940DE4D9103CF930A15750C0A96E948260" | |
alternativeURL: | |
date: | |
publicationDate: "2004-09-03T00:00:00Z" | |
correctDate: "1987-02-04T00:00:00Z" | |
analyzed_text: | |
articleAbstract: "Gov James E McGreevey, ..." |
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
import re | |
from collections import namedtuple | |
import MeCab | |
Node = namedtuple('Node', [ | |
'surface', | |
'base', | |
'reading', | |
'pos', |
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
--- | |
python_version: 3.6.2 |
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
--- | |
pyenv_root: /opt/pyenv | |
pyenv_rcfiles: [] | |
pyenv_versions: [] | |
pyenv_global_version: system | |
pyenv_build_requirements: | |
# https://github.com/pyenv/pyenv/wiki/Common-build-problems | |
- zlib-devel | |
- bzip2 | |
- bzip2-devel |