Skip to content

Instantly share code, notes, and snippets.

@meru-akimbo
meru-akimbo / gist:2702042
Created May 15, 2012 14:08
Learning Perl 9.6-1
$what = "fred|barney";
while(<STDIN>){
if(/($what){3}/g){
print "match\n\n";
}else{
print "no match\n\n";
}
}
@meru-akimbo
meru-akimbo / gist:2702130
Created May 15, 2012 14:21
Learning Perl 9.6-2
$^I = ".out";
while(<>){
s/Fred/Larry/gi;
print;
}
@meru-akimbo
meru-akimbo / gist:2702560
Created May 15, 2012 15:16
Learning Perl 9.6-3
$^I = ".out";
while(<>){
s/Fred/not_using_word/gi;
s/Wilma/Fred/gi;
s/not_using_word/Wilma/gi;
print;
}
chomp($tani = <STDIN>);
chomp($hyouka = <STDIN>);
$hyouka =~ s/A/4/g;
$hyouka =~ s/B/3/g;
$hyouka =~ s/C/2/g;
$hyouka =~ s/D/1/g;
$hyouka =~ s/F/0/g;
@list = split //, $hyouka;
@meru-akimbo
meru-akimbo / gist:2828796
Created May 29, 2012 14:40
B - さかさま辞書
chomp($tango_num = <STDIN>);
while(<STDIN>){
@w = split(//, $_);
@w = reverse(@w);
$s = join('', @w);
push @list , $s;
}
@meru-akimbo
meru-akimbo / gist:2900582
Created June 9, 2012 11:08
CodeSprint Japan 嫌いな数値
use strict;
use 5.12.0;
chomp(my $like = <STDIN>);
chomp(my $hate = <STDIN>);
my @like = split / /, $like;
my @hate = split / /, $hate;
my @waru;
my $i = 1;
@meru-akimbo
meru-akimbo / gist:2902170
Created June 9, 2012 18:45
タイピングゲーム
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<link href="./css/index.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
$(document).ready(function() {
$("#start").click( function() {
var tango = new Array(10); //単語の配列
@meru-akimbo
meru-akimbo / gist:2902179
Created June 9, 2012 18:48
定積分計算機
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link href="./css/index.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#enzan").click( function() {
var a = $("#start").val();
@meru-akimbo
meru-akimbo / gist:2941361
Created June 16, 2012 13:44
AtCoder Regular Contest #004 A
use strict;
use warnings;
use 5.12.4;
chomp(my $n = <STDIN>);
chomp(my @line = <STDIN>);
my $result = 0;
for my $now_point (@line){
@meru-akimbo
meru-akimbo / gist:2953685
Created June 19, 2012 11:44
html5の音声認識を用いたspeaking test
<html lang="en">
<head>
<meta charset="utf-8">
<title>speech test</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>
function speechInput() {
var test = $("#get_voice").val();
if(test.match(/my name is/)){
alert("good! because include 'my name is'");