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 -*- | |
## | |
## enhance to build intermediate data structure | |
## | |
use strict; | |
use warnings; | |
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 -*- | |
## | |
## define topic() and case_when() functions | |
## | |
use strict; | |
use warnings; | |
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 -*- | |
## | |
## define OK() assertion function | |
## | |
use strict; | |
use warnings; | |
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 -*- | |
## | |
## change block arg of spec() to be optional | |
## | |
use strict; | |
use warnings; | |
use Test::More; |
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 -*- | |
## | |
## denfine spec() simply | |
## | |
use strict; | |
use warnings; | |
sub spec { |
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
<?php | |
/// | |
/// generator benchmark | |
/// | |
function create_datafile($filename, $filesize=1024) { | |
$str = "Haruhi\tFemale\t16\tTeam Leader\n" | |
. "Mikuru\tFemale\t17\tTime Traveler\n" | |
. "Yuki\tFemale\t16\tHumanoid Interface\n" |
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
<?php | |
/// | |
/// benchmark: loop vs array vs generator vs inner iterator vs closure | |
/// | |
function create_datafile($filename, $filesize=1024) { | |
$str = "Haruhi\tFemale\t16\tTeam Leader\n" | |
. "Mikuru\tFemale\t17\tTime Traveler\n" | |
. "Yuki\tFemale\t16\tHumanoid Interface\n" |
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 -*- | |
""" | |
pyramid.testing.tearDown()を一度でも実行すると、 | |
pyramid.threadlocal.get_current_registry().settingsが | |
うまくとってこれなくなることを示すサンプル | |
""" | |
import sys | |
import unittest |
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
/* | |
* $Release: $ | |
* $Copyright: copyright(c) 2007-2011 kuwata-lab.com all rights reserved. $ | |
* $License: MIT License $ | |
*/ | |
/** | |
* client-side template engine | |
* | |
* usage: |
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
## | |
## フィボナッチ数列のうち100以下のものを求める | |
## | |
def fibgen(): | |
x, y = 0, 1 | |
while True: | |
yield x | |
x, y = y, x+y |