Skip to content

Instantly share code, notes, and snippets.

View junichiro's full-sized avatar

Junichiro Tobe junichiro

  • Novasell
  • Tokyo, Japan
View GitHub Profile
Games-TicTacToe からモンテカルロ法のアルゴリズムだけ分離する
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
use List::Util qw/shuffle/;
my $roop = 1000;
my $number = 100;
my $limit = 50;
#!/usr/bin/perl
use strict;
use warnings;
sub dirtify {
my $text = shift;
$text =~ s/(\S) +=(>?) +/$1 =$2 /mg;
$text;
}
Contexts
Physical Requirements
- Physical Location
(Office, Home)
- Physical Object
(Phone, Mac, Tool)
- Physical Activity
(Email, Video Editing, Web Design)
- Physical State
(Online, Offline)
// bad
var add_the_handlers = function (nodes) {
var i;
for (i = 0; i < nodes.length; i += 1) {
nodes[i].onclick = function () {
alert(i);
}
}
};
#!/usr/bin/perl
use strict;
use warnings;
use Image::Imlib2;
use Data::Dumper;
my ( $width, $height ) = ( 150, 320 );
my $image_dir = 'images/avater';
my @image_files = glob("$image_dir/*");
// in ZendFramework
// forward
$this->_forward( 'index', 'index', 'product' );
// Exactly the same
$request = $this->getRequest();
$request->setModuleName('product')
->setControllerName('index')
->setActionName('index')
$(document).ready(function(){
var d = new MyApp();
d.init();
});
if( typeof( window.MyApp ) == "undefined") {
// MyApp コンストラクタ
var MyApp = function() { return this; };
var MYAPP = {};
MYAPP.util = {
getData: function ( arg ) {
var query_string = window.document.location.href.split('?')[1];
var datas = query_string.split('&');
var tmp, result, i;
for(i=0; i<datas.length; i++) {
tmp = datas[i].split('=');
result[tmp[0]] = tmp[1];
#!/usr/bin/perl
use strict;
use warnings;
my $example = [1, '', 3, 4, '', ''];
sub func {
my ($example, $value) = @_;
my $ret;