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
FROM ubuntu:14.04 | |
MAINTAINER keigo yamamoto | |
# Set env var | |
ENV DEBIAN_FRONTEND noninteractive | |
# Update repositories & upgread packages | |
RUN sed -i 's/# \(.*multiverse$\)/\1/g' /etc/apt/sources.list | |
RUN apt-get update && apt-get -y upgrade |
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
@namespace url(http://www.w3.org/1999/xhtml); | |
*{ | |
font-family: Yu Mincho;!important | |
} |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<rss version="2.0" | |
xmlns:content="http://purl.org/rss/1.0/modules/content/" | |
xmlns:wfw="http://wellformedweb.org/CommentAPI/" | |
xmlns:dc="http://purl.org/dc/elements/1.1/" | |
xmlns:atom="http://www.w3.org/2005/Atom" | |
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" | |
xmlns:slash="http://purl.org/rss/1.0/modules/slash/" | |
> |
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 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" dir="ltr" lang="ja" xmlns:og="http://ogp.me/ns#"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<meta http-equiv="Content-Style-Type" content="text/css" /> | |
<title>「平均的な手書きフォント」をつくるプロジェクトが参加者募集中 « WIRED.jp</title> | |
<meta name="description" content="ボールペンで有名なフランスのBIC社が、世界の人たちの手書き文字をネット上で募集して、「普遍的な手書きフォント」をつくり出す実験を行っている。" /> |
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 urllib.request | |
import bs4 | |
import time | |
def fetch_page(url): | |
html = urllib.request.urlopen(url).read().decode('utf-8') | |
soup = bs4.BeautifulSoup(html) | |
return soup |
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
res = [ | |
[{k: v-1 for k, v in j.items()} for j in i] for i in d | |
] |
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
class ParentA(): | |
def __init__(self): | |
print('my name is a') | |
self.name = 'A' | |
class ParentB(): | |
def __init__(self): |
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
def as_indexed_json | |
self.as_json( | |
:only => [:id, title, :body], | |
:include => { | |
:user => { | |
:user_nickname => :nickname | |
:methods => :user_fullname # キーがメソッド名固定になるのは残念ポイント。変えられないのかな? | |
} | |
} | |
) |
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
def as_indexed_json | |
self.as_json( | |
:methods => user.get_full_name | |
) | |
end |
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
def self.reindex | |
begin | |
Article.__elasticsearch__.client.indices.delete( | |
index: Article.index_name | |
) | |
rescue | |
nil | |
end | |
Article.__elasticsearch__.client.indices.create( |