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
class Array | |
# 配列の内容が "ズンドコ" か | |
def zundoko? | |
self == %w(ズン ズン ズン ズン ドコ) | |
end | |
end | |
ZUN_DOKO = %w(ズン ドコ) | |
results = [] |
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
ZUN_DOKO = { zun: 'ズン', doko: 'ドコ' } | |
results = [] | |
while results != [:zun, :zun, :zun, :zun, :doko] | |
results << ZUN_DOKO.keys.sample.tap { |key| print ZUN_DOKO[key] } | |
results.shift if results.length > 5 | |
end | |
puts 'キ・ヨ・シ!' |
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
ZUN_DOKO = %w(ズン ドコ) | |
results = [] | |
while results != %w(ズン ズン ズン ズン ドコ) | |
results << ZUN_DOKO.sample.tap { |z| print z } | |
results.shift if results.length > 5 | |
end | |
puts 'キ・ヨ・シ!' |
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
ZUN_DOKO = ['ズン', 'ドコ'] | |
results = [] | |
while true | |
result = ZUN_DOKO.sample | |
print result | |
results << result | |
results.shift if results.length > 5 |
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# All Vagrant configuration is done below. The "2" in Vagrant.configure | |
# configures the configuration version (we support older styles for | |
# backwards compatibility). Please don't change it unless you know what | |
# you're doing. | |
Vagrant.configure(2) do |config| | |
# The most common configuration options are documented and commented below. | |
# For a complete reference, please see the online documentation at |
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# All Vagrant configuration is done below. The "2" in Vagrant.configure | |
# configures the configuration version (we support older styles for | |
# backwards compatibility). Please don't change it unless you know what | |
# you're doing. | |
Vagrant.configure(2) do |config| | |
# The most common configuration options are documented and commented below. | |
# For a complete reference, please see the online documentation at |
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 static spark.Spark.after; | |
import static spark.Spark.delete; | |
import static spark.Spark.get; | |
import static spark.Spark.halt; | |
import static spark.Spark.post; | |
import static spark.Spark.put; | |
import java.util.ArrayList; | |
import java.util.HashMap; | |
import java.util.List; |
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 static spark.Spark.get; | |
public class HelloSpark { | |
public static void main(String[] args) { | |
get("/", (req, res) -> { | |
return "Hello Spark"; | |
}); | |
} | |
} |
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.Arrays; | |
import java.util.List; | |
import java.util.stream.Collectors; | |
public class HelloStreaming { | |
public static void main(String... args) { | |
List<String> numbers = Arrays.asList("4", "5", "1", "2", "3", "4", "5"); | |
// map | |
numbers.stream().map(num -> Integer.parseInt(num)) // String型をInteger型に変換(マッピング)する |
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; | |
import java.util.List; | |
public class HelloLambda { | |
public static void main(String... args) { | |
List<String> names = new ArrayList<>(); | |
names.add("sample 1"); | |
names.add("sample 2"); | |
names.add("sample 3"); |