From 67744974df46b1f78de9acc227f62d1e6db5f393 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Tue, 17 Jan 2023 01:21:52 +0900 Subject: スライド作成 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + Dockerfile | 14 +++++++ Makefile | 33 +++++++++++++++ assets/me.jpeg | Bin 0 -> 10890 bytes polyglot.txt | 12 ++++++ slide.pdf | Bin 0 -> 170329 bytes slide.saty | 124 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ test.sh | 13 ++++++ 8 files changed, 197 insertions(+) create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 Makefile create mode 100644 assets/me.jpeg create mode 100644 polyglot.txt create mode 100644 slide.pdf create mode 100644 slide.saty create mode 100644 test.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..19780ee --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/slide.satysfi-aux diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0cbb1ff --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM amutake/satysfi + +RUN opam update && \ + opam install satysfi-base + +RUN opam install satysfi-class-slydifi && \ + opam install satysfi-code-printer && \ + opam install satysfi-fonts-noto-sans && \ + opam install satysfi-fonts-noto-sans-cjk-jp + +RUN eval $(opam env) && \ + satyrographos install + +WORKDIR /work diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..34d193e --- /dev/null +++ b/Makefile @@ -0,0 +1,33 @@ +.PHONY: all +all: slide.pdf + +slide.pdf: slide.saty + docker run \ + -it \ + --rm \ + --name satysfi \ + --mount type=bind,src=$$(pwd),dst=/work \ + satysfi \ + satysfi slide.saty + +.PHONY: shell +shell: + docker run \ + -it \ + --rm \ + --name satysfi \ + --mount type=bind,src=$$(pwd),dst=/work \ + satysfi \ + sh + +.PHONY: docker +docker: + docker build --tag satysfi . + +.PHONY: clean +clean: + rm -f *.pdf *.satysfi-aux + +.PHONY: test +test: + @bash test.sh diff --git a/assets/me.jpeg b/assets/me.jpeg new file mode 100644 index 0000000..4e01020 Binary files /dev/null and b/assets/me.jpeg differ diff --git a/polyglot.txt b/polyglot.txt new file mode 100644 index 0000000..a61b4fd --- /dev/null +++ b/polyglot.txt @@ -0,0 +1,12 @@ +# CodePrinter.set-number-fun CodeDesign.number-fun-null + )(s); + > + +open FigBox +in + +document '< + +make-title(| + title = { + |明日のあなたの役に立たない + |PHPコーディング技法 + |~polyglot~ + |}; + author = {|nsfisis (いまむら)|}; + date = {|第148回PHP勉強会@東京|}; + |); + + +frame{自己紹介}< + +fig-center(vconcat [ + hconcat [ + textbox{nsfisis (いまむら)}; + gap 20pt; + include-image 50pt `assets/me.jpeg`; + ]; + gap 20pt; + textbox{\@ デジタルサーカス株式会社}; + ]); + > + + +frame{Polyglotとは}< + +fig-center(vconcat [ + textbox{単一のソースコードが複数の言語として解釈可能なプログラム}; + gap 20pt; + textbox{今回はPHP・Ruby・Perlの組み合わせ}; + ]); + > + + +frame{ソースコード}< + +code-block( + `# + + +frame{PHPとして解釈する}< + +code-block( + `# + + +frame{PHPとして解釈する}< + +code-block( + `$a = 'a'; $/* 0; # */$a +=begin +();` + ); + +p{ + \inline-code(`$a`); に \inline-code(`'a'`); を代入 + } + +p{ + \inline-code(`$$a = begin();`); (variable variable) + } + > + + +frame{PHPとして解釈する}< + +code-block( + `echo "php\n";` + ); + +p{ + 出力部分。実際の出力には先頭に \inline-code(`#`); が付く + } + > + + +frame{PHPとして解釈する}< + +code-block( + `function begin() {} $a = << + + +frame{おわりに}< + +fig-center(vconcat [ + textbox{これにもう1言語足したものを}; + gap 20pt; + textbox{PHPerKaigi 2023のPHPerチャレンジに出題します!}; + ]); + > +> diff --git a/test.sh b/test.sh new file mode 100644 index 0000000..87efd7c --- /dev/null +++ b/test.sh @@ -0,0 +1,13 @@ +if [[ ! "$(php polyglot.txt)" = '#php' ]]; then + echo php >&2 + exit 1 +fi +if [[ ! "$(ruby polyglot.txt)" = '#ruby' ]]; then + echo ruby >&2 + exit 1 +fi +if [[ ! "$(perl polyglot.txt)" = '#perl' ]]; then + echo perl >&2 + exit 1 +fi +echo okay -- cgit v1.2.3-70-g09d2