Skip to content

Instantly share code, notes, and snippets.

@tomcha
tomcha / noujiru
Last active December 19, 2015 23:59
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
binmode STDOUT,":utf8";
use Net::Twitter::Lite::WithAPIv1_1;
use Time::Piece;
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use Data::Dumper;
binmode STDIN,":encoding(UTF-8)";
binmode STDOUT,":utf8";
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
sub fizzbuzz{
my $n = shift;
return 'FizzBuzz' if &is_fizz($n) && &is_buzz($n);
return 'Fizz' if &is_fizz($n);
return 'Buzz' if &is_buzz($n);
# fizzbuzz.t
use strict;
use warnings;
use Test::More;
require_ok( 'fizzbuzz.pl' );
ok( &fizzbuzz(1) == 1,'1を与えたとき1を返す' );
is( &fizzbuzz(3) , 'Fizz' , '3を与えたときFizzを返す' );
is( &fizzbuzz(6) , 'Fizz' , '3の倍数を与えたときFizzを返す' );
is( &fizzbuzz(5) , 'Buzz' , '5を与えたときBuzzを返す' );
@tomcha
tomcha / neko.pl
Last active December 21, 2015 01:48
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use TestPackages::Neko;
my $neko1 = Neko->new();
my $neko2 = Neko->new();
@tomcha
tomcha / NekoClass
Last active December 21, 2015 01:48
package Neko;
sub new{
my $class = shift;
my $self = {
name => 'none',
color => 'none'
};
return bless $self,$class;
}
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
binmode STDOUT,":utf8";
use Data::Dumper;
@tomcha
tomcha / encoding
Last active December 22, 2015 10:29
#!/usr/bin/env perl
use strict;
use warnings;
#use utf8;
use Data::Dumper;
binmode STDIN,":utf8";
binmode STDOUT,":utf8";
binmode STDERR,":utf8";
@tomcha
tomcha / FizzBuzz_js
Last active January 1, 2016 08:59
javascriptでFizzBuzz書いてみた
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf8">
<script type="text/javascript">
var $html = "";
for (var i = 1; i <= 100; i++){
if( i % 15 == 0){
$html += "FizzBuzz<br>";
}else if( i % 3 == 0){
@tomcha
tomcha / arrayを触る
Created December 25, 2013 14:48
kosigayajsの練習問題。console.log()が便利。
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Tyoe" content="text/html" charset="utf-8">
<script type="text/javascript">
var numbers = [[10,50],[48,40,88],[39,77]];
console.log(numbers[1][2]);
</script>
</head>
<body>