Skip to content

Instantly share code, notes, and snippets.

View hiratara's full-sized avatar
🇯🇵
born in Japan

Masahiro Honma hiratara

🇯🇵
born in Japan
View GitHub Profile
package main;
use strict;
use warnings;
my $board = Board->new(
table => [
[-1,-1, 0, 1, 1,-1,-1],
[ 0, 0, 0, 0, 1, 2,-1],
[ 0, 8, 0, 2, 2, 2, 0],
[ 8, 8, 0, 6, 0, 3, 3],
[ 8, 7, 0, 5, 0, 3, 4],
<html>
<head>
<script type="text/javascript">
function push_codes(arr, char1, char2){
for(var i = char1.charCodeAt(0) ; i <= char2.charCodeAt(0); i++){
arr.push( String.fromCharCode(i) );
}
}
function make_password(alpha, len){
open(OUT,">test.php");
print OUT "<?php\n";
print OUT "/*\n";
print OUT "     ____\n";
print OUT "   /__.))ノヽ\n";
print OUT "   .|ミ.l _  ._ i.)  \n";
print OUT "  (^'ミ/.´・ .〈・ リ   phpはわしが育てた\n";
print OUT "  .しi   r、_) |  \n";
print OUT "    |  `ニニ' /   \n";
print OUT "   ノ `ー―i\n";
#/usr/bin/perl
# perlのパスが違う時はここを書き換える
# 2008/12/05 コメントを新しく記述 by 高橋
# 2009/02/13 全体的にコメントが足りないので追加 by 高橋
use strict; # おまじない(どこかのサイトで見た気がします)
use warnings; # おまじない(どこかのサイトで見た気がします)
# @hello配列をmyで宣言する
my @hello;
# 配列に、Hとeとlとlとoと空白文字( )とWとrとoとlとdと改行文字(\n)を代入
push @hello, 'H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd', "\n";
use strict;
use warnings;
use AI::NeuralNet::Simple;
use GD;
my $width = 200;
my $height = 200;
my @classes = (
{
@hiratara
hiratara / gist:87396
Created March 29, 2009 13:35
pmap.pl
package MyFilter;
use metaclass 'MooseX::POE::SweetArgs';
use MooseX::POE;
has cont => (
isa => 'ArrayRef',
is => 'ro',
required => 1,
);
package MyPmap::Filter;
use metaclass 'MooseX::POE::SweetArgs';
use MooseX::POE;
use POE::Wheel::Run;
has cont => (
isa => 'ArrayRef',
is => 'ro',
required => 1,
);
<html>
<body>
<script type="text/javascript">
var noReturn = (function () {})();
document.write("NO RETURN:" + noReturn + "<br>");
var explicitReturn = (function () {return false;})();
document.write("EXPLICIT RETURN:" + explicitReturn + "<br>");
</script>
</body>
</html>
#!/usr/local/bin/perl
use strict;
use warnings;
sub usage{
die "USAGE: $0 MIHH MIHH";
}
sub format_cmd{
-- http://projecteuler.net/index.php?section=problems&id=4
intToPalindrome :: (Num a, Read a) => a -> a
intToPalindrome x = x * 1000 + ( read . reverse . show) x
palindromes = [intToPalindrome n | n <- [999,998..100] ]
is3by3 n = or $ map (\m -> and [n `mod` m == 0, is3 $ n `div` m]) [100 .. 999]
where is3 l = and [l >= 100, l < 1000]