puts 'The best way to log and share programmers knowledge.'
puts 'The best way to log and share programmers knowledge.'
また、コードをインライン表示することも可能です。
public function setPhoto() | |
{ | |
$options = array( | |
'file_src' => '', | |
'is_image' => true, | |
'with_delete' => false, | |
'template' => get_partial('default/formEditImage', array('image' => $this->getObject())), | |
); | |
$this->setWidget('photo', new sfWidgetFormInputFileEditable($options, array('size' => 40))); | |
$this->setValidator('photo', new opValidatorImageFile(array('required' => false))); |
# -*- coding: utf-8 -*- | |
class Hoge(object): | |
def foo(self, num): | |
""" | |
0~num-1までの数字をリスト形式で作成する | |
>>> a = Hoge() | |
>>> a.foo(5) | |
[0, 1, 2, 3, 4] | |
""" | |
return [e for e in range(num)] |
#!/usr/bin/env python | |
# coding: utf-8 | |
"""myprofiler - Casual MySQL Profiler | |
https://github.com/methane/myprofiler | |
""" | |
import os | |
import sys |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import simplejson | |
from collections import defaultdict | |
FILE_PATH = u'/Users/mogihiroki/Downloads/limited-quest.json' | |
f=open(FILE_PATH) | |
data=simplejson.load(f) | |
f.close() |
#!/usr/bin/python | |
# coding: UTF-8 | |
""" | |
urlからテキストを抽出して解析 | |
""" | |
import re | |
import urllib2 | |
import time | |
from collections import defaultdict |
#!/usr/bin/python | |
# coding: UTF-8 | |
""" | |
何かしらの2chURL一覧からスレのIDを取ってファイルに保存 | |
""" | |
import re | |
import urllib2 | |
import copy | |
def get_html(url): |
fork したものを写経してみた。 | |
割とtypoしててびびった。 |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
""" | |
class BaseRule(object): | |
def __init__(self, cell): | |
self.cell = cell | |
def valid(): | |
raise NotImplementedError |
def trim_duplicate_by_objects_list(objects_list, obj_attr_name): | |
trimd = {} | |
for o in objects_list: | |
key = getattr(o, obj_attr_name) | |
if not key: | |
continue | |
trimd[key] = o | |
return trimd.values() |