This file contains hidden or 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 | |
class matching(object): | |
def __init__(self, string): | |
self.string = string | |
self.matched = None |
This file contains hidden or 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 -*- | |
- page: 55 | |
text: "暗号化したパスワード文字列を送信する「md5」方式" | |
comment: MD5 はハッシュ値を計算するだけであり、暗号化するわけではないのでは? | |
- page: 69 | |
item: 表4-3 | |
text: "同時に実行されている他のトランザクションが書き込んでいるがコミットされていないデータを読み込んでしまう" | |
comment: "同時に実行されている他のトランザクションが、書き込んでいるがコミットされていないデータを読み込んでしまう" |
This file contains hidden or 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 sum(xs): | |
t = 0 | |
for x in xs: | |
t += x | |
return t | |
## 再帰呼び出し | |
def sum(xs): | |
if not xs: |
This file contains hidden or 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
### | |
### templating.php | |
### | |
<?php | |
function h($str) { | |
return htmlspecialchars($str, ENT_QUOTES, 'UTF-8'); | |
} | |
function print_template($template_filename, $vars) { ## テンプレートへの値は連想配列$varsで渡す |
This file contains hidden or 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 sys | |
try: | |
xrange | |
except NameError: | |
xrange = range | |
This file contains hidden or 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 sys | |
try: | |
xrange | |
except NameError: | |
xrange = range | |
This file contains hidden or 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, random | |
from sqlalchemy.exc import IntegrityError | |
from smapo.common.models.event import EventOperation | |
from smapo.common.models.base import ( | |
DBSession, RedirectPage, RedirectUniqueCode, UserActionHistory, | |
) |
This file contains hidden or 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
## | |
## SQLAlchemyで、条件を動的に追加するときの書き方 | |
## | |
## | |
## before | |
## | |
q = db.query(Model) \ | |
.filter(Model.created_at >= date(2015, 6, 1) | |
if kind: |
This file contains hidden or 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 -*- | |
/// | |
/// very small DOM builder using wabi-sabi style | |
/// | |
/// Example: | |
/// | |
/// var a = dom(["a", {href: "/link"}, "Link"]); | |
/// console.log(a); | |
/// //=> <a href="/link">Link</a> |
This file contains hidden or 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 os.path import getmtime | |
class TemplateError(Exception): |