This file contains 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 | |
class KaraokeMachine | |
attr_accessor :melody | |
def initialize(melody) | |
@melody = melody | |
end | |
def transpose(amount) | |
amount %= 12 |
This file contains 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
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
#値渡し | |
array_a = [0,1,2] | |
array_b = array_a.dup | |
array_b[1] = 'a' | |
p array_a | |
#参照渡し |
This file contains 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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Data::Dumper; | |
#値渡し | |
my @array_a = (0, 1, 2); | |
my @array_b = @array_a; |
This file contains 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
#!/usr/bin/env perl | |
#use 5.012; | |
use warnings; | |
use strict; | |
#foreach (glob ('*')) { | |
# my $dest = readlink $_; | |
# print "$_ -> $dest\n" if defined $dest; | |
#} |
This file contains 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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use utf8; | |
binmode STDIN,":encoding(UTF8)"; | |
binmode STDOUT,":utf8"; | |
binmode STDERR,":utf8"; |
This file contains 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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Data::Dumper; | |
print "1つ目の数字を入力して下さい >>"; | |
my $i = <STDIN>; | |
chomp $i; |
This file contains 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
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use utf8; | |
sub pickle{ | |
my $filepath = shift; | |
my $vegetable = shift; | |
chomp($filepath); |
This file contains 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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Data::Dumper; | |
use lib "./lib"; | |
use nukaduke; |
This file contains 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
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
def check_prime(num,array) | |
i = 0 | |
sq_number = Math.sqrt(num).ceil.to_i | |
array.size.times do | |
if num % array[i] == 0 | |
return false | |
else |
This file contains 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
import java.util.ArrayList; | |
public class Prime{ | |
public static void main(String[] args){ | |
long start = System.currentTimeMillis(); | |
// System.out.println(2); | |
// System.out.println(3); | |
int num = 5; | |
ArrayList<Integer> array = new ArrayList<Integer>(); | |
array.add(2); |
OlderNewer