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
package sample; | |
public class App { | |
public String getGreeting() { | |
return "Hello world."; | |
} | |
public static void main(String[] args) { | |
String yaml = readResource("/foo.yml"); | |
System.out.println(yaml); |
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
// src/main/java/sample/App.java | |
package sample; | |
import java.io.File; | |
import java.net.URL; | |
import liqp.Template; | |
public class App { | |
public static void main(String[] args) { |
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
// src/main/java/sample/App.java | |
package sample; | |
import java.util.Map; | |
import org.yaml.snakeyaml.Yaml; | |
public class App { | |
public static void main(String[] args) { | |
try { |
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
defmodule TestMacro do | |
defmacro dtest(desc, input, expect) do | |
quote do | |
test unquote(desc) do | |
assert unquote(expect) == Sample.solve(unquote(input)) | |
end | |
end | |
end | |
end |
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
% orde29.prolog | |
% | |
% http://nabetani.sakura.ne.jp/hena/orde29unes/ | |
% | |
% compiler: | |
% GNU-Prolog ( http://www.gprolog.org ) | |
% | |
% compile: | |
% $ gplc --no-top-level orde29.prolog | |
% |
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
require 'redcarpet' | |
require 'nokogiri' | |
require 'securerandom' | |
require 'gepub' | |
Chapter = Struct.new("Chapter", :title, :body) | |
def split_md_into_chapters(source) | |
result = [] | |
title = nil |
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
% 偽クフ語解読器 | |
% decode.prolog | |
% 規則 | |
% 1. S -> U 011 U (U 'ならば' U) | |
s(LHS, RHS) :- | |
append(U1, [0'0, 0'1, 0'1 | U2], LHS), | |
u(U1, T_U1), | |
u(U2, T_U2), |
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 | |
require 'pathname' | |
require 'thor' | |
require 'gepub' | |
require 'redcarpet' | |
class Md2EPub < Thor | |
default_command :pub |
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
defmodule Orde29 do | |
@moduledoc """ | |
オフラインリアルタイムどう書く E29 | |
[アンエスケープ 2018.12.8](http://nabetani.sakura.ne.jp/hena/orde29unes/) を Elixir で解きました。 | |
基本的なアイディアとしては [Ruby 版](https://github.com/mattsan/orde29_ruby) と同じです。 | |
パース中に結果の文字列の内容をチェックして不正な結果になることがわかった時点で終了するようにしています。 | |
`tail` は結果の文字列の末尾の文字なので冗長ですが、文字列の末尾の文字を取り出す手間が面倒だったので独立したパラメータで渡すようにしています。 | |
""" |
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
defmodule MyRange do | |
@moduledoc """ | |
自作の Range の実装 | |
詳しくは [Enumerable protocol のドキュメント](https://hexdocs.pm/elixir/Enumerable.html)を参照。 | |
""" | |
defstruct first: 0, last: 0 | |
def new(first, last) do |