JavaScriptをテストするのに、テストフレームワークとして、 QUnitを使い、PhantomJSでコンソールでテストできるようにした。
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
#include <cstdlib> | |
#include <iostream> | |
struct Die { | |
template <typename T> | |
operator T() { | |
std::cout << "Die!!" << std::endl; | |
std::exit(1); | |
} | |
} die; |
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 MemcacheLock(object): | |
""" | |
memcacheのLockオブジェクト | |
""" | |
LOCK_CACHE_VALUE = 'ALL' | |
def __init__(self, cache, key): | |
self.cache = cache | |
self.key = key |
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 ListFormMixin(MultipleObjectMixin, FormMixin): | |
'''フォームを持つListViewの実装のためのMixin | |
memo: | |
get_context_dataメソッドが重複する | |
''' | |
class BaseListFormView(ListFormMixin, View): | |
def get(self, request, *args, **kwargs): |
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 os | |
import sys | |
class ParallelFor(object): | |
def __init__(self, iterable, num_children=2): | |
self.iterable = iterable | |
self.num_children = num_children | |
self._is_child = False | |
self._working = None |
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 django.utils import tree | |
PATTERN_DICT = { | |
"ALPHABET": r"a-zA-Z", | |
"NUMBER": r"0-9", | |
} | |
class S(tree.Node): | |
""" |
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 | |
RUBY_LIST = ( | |
(100, u"ひゃく"), | |
(10, u"じゅう"), | |
(9, u"きゅう"), | |
(8, 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 -*- | |
import re | |
regexps = { | |
'escaped': ur''' | |
\\ # Escape | |
((?P<standard>["\\/bfnrt]) # Standard escapes | |
| (u(?P<unicode>[0-9A-Fa-f]{4}))) # uXXXX | |
''', |
numpy&scipy周りのOSXへのインストールはsuperpackが楽
OlderNewer