rabbit-slide-QWYNG-qwyng_slide 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rabbit +2 -0
- data/README.md +24 -0
- data/Rakefile +17 -0
- data/abc150a.png +0 -0
- data/config.yaml +23 -0
- data/img.png +0 -0
- data/letsplayatcoder.md +133 -0
- data/pdf/qwyng_slide-letsplayatcoder.pdf +0 -0
- metadata +64 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: bc7d11dee87323778d42a068f7fe29ee8e07bdc112bf0076b90ad219a97a17a5
|
4
|
+
data.tar.gz: d8a3cae99c7fff35211ad3b383cdb98121361114a0a140ec8f1191edd8b3f05c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 74341f1e5487fd4ca0fda710190a04ef2e2ea0bcd87846a32620ea087b0757695dfeda4f27aea928d84bdc69408f69c3de0eac1452e927a46adeb1803c2492ca
|
7
|
+
data.tar.gz: 296f93777df60600062d9ecbd007ba5b0506c7d70db80d5e70a2da4235c0f65d06408e96218ae94de257db2c358e76c2963eb44cd1d78b40582216cdee025ea6
|
data/.rabbit
ADDED
data/README.md
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# My Ruby tools for AtCoder
|
2
|
+
|
3
|
+
自作のAtCoder用Rubyツールの紹介スライドです。
|
4
|
+
|
5
|
+
## 作者向け
|
6
|
+
|
7
|
+
### 表示
|
8
|
+
|
9
|
+
rake
|
10
|
+
|
11
|
+
### 公開
|
12
|
+
|
13
|
+
rake publish
|
14
|
+
|
15
|
+
## 閲覧者向け
|
16
|
+
|
17
|
+
### インストール
|
18
|
+
|
19
|
+
gem install rabbit-slide--qwyng_slide
|
20
|
+
|
21
|
+
### 表示
|
22
|
+
|
23
|
+
rabbit rabbit-slide--qwyng_slide.gem
|
24
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require "rabbit/task/slide"
|
2
|
+
|
3
|
+
# Edit ./config.yaml to customize meta data
|
4
|
+
|
5
|
+
spec = nil
|
6
|
+
Rabbit::Task::Slide.new do |task|
|
7
|
+
spec = task.spec
|
8
|
+
# spec.files += Dir.glob("doc/**/*.*")
|
9
|
+
# spec.files -= Dir.glob("private/**/*.*")
|
10
|
+
# spec.add_runtime_dependency("rabbit-theme-YOUR-THEME")
|
11
|
+
end
|
12
|
+
|
13
|
+
desc "Tag #{spec.version}"
|
14
|
+
task :tag do
|
15
|
+
sh("git", "tag", "-a", spec.version.to_s, "-m", "Publish #{spec.version}")
|
16
|
+
sh("git", "push", "--tags")
|
17
|
+
end
|
data/abc150a.png
ADDED
Binary file
|
data/config.yaml
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
---
|
2
|
+
id: qwyng_slide
|
3
|
+
base_name: letsplayatcoder
|
4
|
+
tags: []
|
5
|
+
presentation_date:
|
6
|
+
presentation_start_time:
|
7
|
+
presentation_end_time:
|
8
|
+
version: 1.0.0
|
9
|
+
licenses: []
|
10
|
+
slideshare_id:
|
11
|
+
speaker_deck_id:
|
12
|
+
vimeo_id:
|
13
|
+
youtube_id:
|
14
|
+
width: 1920
|
15
|
+
height: 1080
|
16
|
+
source_code_uri:
|
17
|
+
author:
|
18
|
+
markup_language: :markdown
|
19
|
+
name: QWYNG
|
20
|
+
email: ikusawasi@gmail.com
|
21
|
+
rubygems_user: QWYNG
|
22
|
+
slideshare_user:
|
23
|
+
speaker_deck_user:
|
data/img.png
ADDED
Binary file
|
data/letsplayatcoder.md
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
# My Ruby tools for AtCoder
|
2
|
+
|
3
|
+
author
|
4
|
+
: QWYNG(大澤広朗)
|
5
|
+
|
6
|
+
institution
|
7
|
+
: SmartHR LT会 May, 2024
|
8
|
+
|
9
|
+
theme
|
10
|
+
: rabbit
|
11
|
+
|
12
|
+
|
13
|
+
# AtCoderにRubyで参加する
|
14
|
+
* AtCoder: 競技プログラミングのコンテストを開催しているサービス
|
15
|
+
* https://atcoder.jp
|
16
|
+
* Rubyで参加する際に利用している自作ツールの自慢をします
|
17
|
+
* Rubyを使ったアルゴリズムの解説はしません
|
18
|
+
|
19
|
+
# AtCoderに参加するときの流れ
|
20
|
+
1. サンプル入出力からテストを生成する
|
21
|
+
2. 問題を解く
|
22
|
+
3. デバックする
|
23
|
+
4. テストを通す
|
24
|
+
5. 提出
|
25
|
+
|
26
|
+
* 1と3で自作ツールを使っています
|
27
|
+
|
28
|
+
|
29
|
+
# サンプル入出力からテストを生成する
|
30
|
+
* green_day
|
31
|
+
* https://github.com/QWYNG/green_day
|
32
|
+
* 自作のスクレイピングツール
|
33
|
+
* 問題の入出力からテストを自動生成してくれます
|
34
|
+
* コンテスト開催中等クッキーが必要な場合にも対応しています
|
35
|
+
|
36
|
+
# green_dayのデモ(1)
|
37
|
+
![abc150a](./abc150a.png){:width='1280' height='720'}
|
38
|
+
|
39
|
+
# green_dayのデモ(2)
|
40
|
+
```shell
|
41
|
+
$ bundle exec green_day new abc150
|
42
|
+
```
|
43
|
+
|
44
|
+
```shell
|
45
|
+
abc150
|
46
|
+
├── A.rb
|
47
|
+
├── B.rb
|
48
|
+
├── C.rb
|
49
|
+
├── D.rb
|
50
|
+
├── E.rb
|
51
|
+
├── F.rb
|
52
|
+
└── spec
|
53
|
+
├── A_spec.rb
|
54
|
+
├── B_spec.rb
|
55
|
+
├── C_spec.rb
|
56
|
+
├── D_spec.rb
|
57
|
+
├── E_spec.rb
|
58
|
+
└── F_spec.rb
|
59
|
+
```
|
60
|
+
|
61
|
+
# green_dayのデモ(3)
|
62
|
+
|
63
|
+
```ruby
|
64
|
+
RSpec.describe 'abc150/A.rb' do
|
65
|
+
it 'test with "2 900\n"' do
|
66
|
+
io = IO.popen('ruby abc150/A.rb', 'w+')
|
67
|
+
io.puts("2 900\n")
|
68
|
+
io.close_write
|
69
|
+
expect(io.readlines.join).to eq("Yes\n")
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'test with "1 501\n"' do
|
73
|
+
io = IO.popen('ruby abc150/A.rb', 'w+')
|
74
|
+
io.puts("1 501\n")
|
75
|
+
io.close_write
|
76
|
+
expect(io.readlines.join).to eq("No\n")
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'test with "4 2000\n"' do
|
80
|
+
io = IO.popen('ruby abc150/A.rb', 'w+')
|
81
|
+
io.puts("4 2000\n")
|
82
|
+
io.close_write
|
83
|
+
expect(io.readlines.join).to eq("Yes\n")
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
87
|
+
```
|
88
|
+
|
89
|
+
# デバックする(1)
|
90
|
+
テストで入出力をキャプチャしているのでREPLが動かない
|
91
|
+
|
92
|
+
```shell
|
93
|
+
> rspec abc150/spec/A_spec.rb
|
94
|
+
FFF
|
95
|
+
|
96
|
+
Failures:
|
97
|
+
|
98
|
+
1) abc150/A.rb test with "2 900\n"
|
99
|
+
Failure/Error: expect(io.readlines.join).to eq("Yes\n")
|
100
|
+
~~~~~~~~ snip ~~~~~~~~
|
101
|
+
(compared using ==)
|
102
|
+
|
103
|
+
Diff:
|
104
|
+
@@ -1,9 +1,18 @@
|
105
|
+
+
|
106
|
+
+From: abc150/A.rb @ line 3 :
|
107
|
+
+
|
108
|
+
+ 1: k, x = gets.split.map(&:to_i)
|
109
|
+
+ 2: check_complition = '予測変換もいい感じになってほしいなぁ'
|
110
|
+
+ => 3: binding.irb
|
111
|
+
+ 4: puts k * 500 >= x ? 'Yes' : 'No'
|
112
|
+
+Switch to inspect mode.
|
113
|
+
+
|
114
|
+
Yes
|
115
|
+
```
|
116
|
+
|
117
|
+
# デバックする(2)
|
118
|
+
* リモートプロセスのIRBを別のプロセスから操作することができるGemを作りました
|
119
|
+
* https://github.com/QWYNG/irb-remote
|
120
|
+
|
121
|
+
# irb-remoteのデモ(1)
|
122
|
+
![irb-remote](./img.png){:width='1280' height='720'}
|
123
|
+
|
124
|
+
# irb-remoteの先行研究
|
125
|
+
* dRubyを使ってオブジェクトをプロセス間でやりとりしています
|
126
|
+
* dRubyでREPLを行う発想は先人の方を参考にしたものです
|
127
|
+
* https://github.com/Mon-Ouie/pry-remote
|
128
|
+
* https://github.com/iguchi1124/irb_remote
|
129
|
+
* 今回はRelineを使いたかったので自作しました
|
130
|
+
|
131
|
+
# まとめ
|
132
|
+
* 皆さんもぜひ使ってみてください
|
133
|
+
|
Binary file
|
metadata
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rabbit-slide-QWYNG-qwyng_slide
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- QWYNG
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-06-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rabbit
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.0.2
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.0.2
|
27
|
+
description: 自作のAtCoder用Rubyツールの紹介スライドです。
|
28
|
+
email:
|
29
|
+
- ikusawasi@gmail.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- ".rabbit"
|
35
|
+
- README.md
|
36
|
+
- Rakefile
|
37
|
+
- abc150a.png
|
38
|
+
- config.yaml
|
39
|
+
- img.png
|
40
|
+
- letsplayatcoder.md
|
41
|
+
- pdf/qwyng_slide-letsplayatcoder.pdf
|
42
|
+
homepage: https://slide.rabbit-shocker.org/authors/QWYNG/qwyng_slide/
|
43
|
+
licenses: []
|
44
|
+
metadata: {}
|
45
|
+
post_install_message:
|
46
|
+
rdoc_options: []
|
47
|
+
require_paths:
|
48
|
+
- lib
|
49
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '0'
|
59
|
+
requirements: []
|
60
|
+
rubygems_version: 3.4.10
|
61
|
+
signing_key:
|
62
|
+
specification_version: 4
|
63
|
+
summary: My Ruby tools for AtCoder
|
64
|
+
test_files: []
|