aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2023-01-17 01:21:52 +0900
committernsfisis <nsfisis@gmail.com>2023-01-17 01:21:57 +0900
commit67744974df46b1f78de9acc227f62d1e6db5f393 (patch)
treea75d847d347f9f9c81bb8fe82848d9b158272e77
parent00b1a28374f71dcb521662788343cd72f53f5c22 (diff)
downloadphpstudy-148-slides-67744974df46b1f78de9acc227f62d1e6db5f393.tar.gz
phpstudy-148-slides-67744974df46b1f78de9acc227f62d1e6db5f393.tar.zst
phpstudy-148-slides-67744974df46b1f78de9acc227f62d1e6db5f393.zip
スライド作成
-rw-r--r--.gitignore1
-rw-r--r--Dockerfile14
-rw-r--r--Makefile33
-rw-r--r--assets/me.jpegbin0 -> 10890 bytes
-rw-r--r--polyglot.txt12
-rw-r--r--slide.pdfbin0 -> 170329 bytes
-rw-r--r--slide.saty124
-rw-r--r--test.sh13
8 files changed, 197 insertions, 0 deletions
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
--- /dev/null
+++ b/assets/me.jpeg
Binary files 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 @@
+#<?php
+$a = 'a'; $/* 0; # */$a
+=begin
+();
+echo "php\n";
+function begin() {} $a = <<<nil
+=end
+puts "#ruby"; '
+=cut
+print "#perl\n";
+'# ';
+nil;
diff --git a/slide.pdf b/slide.pdf
new file mode 100644
index 0000000..5d0eaec
--- /dev/null
+++ b/slide.pdf
Binary files differ
diff --git a/slide.saty b/slide.saty
new file mode 100644
index 0000000..8677075
--- /dev/null
+++ b/slide.saty
@@ -0,0 +1,124 @@
+@require: class-slydifi/theme/akasaka
+@require: code-printer/code-design
+@require: code-printer/code-printer
+@require: figbox/figbox
+
+let-block +code-block s = '<
+ +code-printer?:(
+ CodePrinter.default
+ |> 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(
+ `#<?php
+$a = 'a'; $/* 0; # */$a
+=begin
+();
+echo "php\n";
+function begin() {} $a = <<<nil
+=end
+puts "#ruby"; '
+=cut
+print "#perl\n";
+'# ';
+nil;`
+ );
+ +p{
+ 実行結果: \inline-code(`#php`);、\inline-code(`#ruby`);、\inline-code(`#perl`);
+ }
+ >
+
+ +frame{PHPとして解釈する}<
+ +code-block(
+ `#<?php`
+ );
+ +p{
+ \inline-code(`#`); とPHPタグ
+ }
+ >
+
+ +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 = <<<nil
+=end
+puts "#ruby"; '
+=cut
+print "#perl\n";
+'# ';
+nil;`
+ );
+ +p{
+ 関数 \inline-code(`begin()`); を定義
+ }
+ +p{
+ Here document (delimiter: \inline-code(`nil`);) で残りを飲み込む
+ }
+ >
+
+ +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