- このPodcastって何?
- 神奈川Ruby会議お疲れ様でした
- 良かったこと、課題だったこと
- 次回もやります?
- 各セッションを振り返り?
- ペアプロ
- 問題難しくない?
- ペア分けについて
- 高橋会長のお話
- ペアプロ
- 自分はRuby初心者?中級者?上級者?
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 "json" | |
require "yaml" | |
def yaml_file_dump(datas) | |
File.open("nike_run_logs.yml", "a") { |f| | |
f.write(YAML.dump(datas)) | |
} | |
end | |
run_datas = [] |
数ある地域Ruby会議の中でも、ペアプロ大会があるのは神奈川Ruby会議ぐらいでしょう。CodeIQで数多くの問題を作成されている@Nabetaniさん作の問題を1時間弱でランダムに組まれたペアで解くというセッションが開催されました。
今回は、遠い世界の数式という問題が出題されました。普段使っている演算子の優先順位が異なっており、ぱっと見、『難しそう』という印象を持たれる方もちらほら。しかしながら、予め用意されたヒントやTAさん、そしてペア同士が開始直後から活発な議論を進めて、終盤にはあちらこちらで「できた!」とか「やった!」といった歓声が飛んでいました。
会場正面では、デモペアプロと称して、ペアプロの様子をスクリーンに映しながら解いてもらいました。最初は緊張気味だったお二人も、時間が経つにつれ実装が進み、無事1時間以内に全テストをパスすることが出来ました。プレッシャーがかかる中、問題を解ききった二人には大きな拍手が贈られました。
その後は、問題作成者である@Nabetaniさんによる問題解説と模範解答例の紹介。模範解答例ではものすごくシンプルに書かれた実装例に対して、会場からはため息にも似た感嘆の声があちこちで起こっていました。
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
# coding: utf-8 | |
require 'nori' | |
puts Nori.new.parse("<value> 全角文字 </value>") # => { "value"=>"全角文字 "} | |
puts Nori.new(parser: :rexml).parse("<value> 全角文字 </value>") # => {"value"=>" 全角文字 "} | |
puts Nori.new.parse("<value> zenkaku </value>") # => {"value"=>" zenkaku "} |
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
[~/work/hypermicrodata]$ ruby -v | |
jruby 1.7.15 (1.9.3p392) 2014-09-03 82b5cc3 on Java HotSpot(TM) 64-Bit Server VM 1.8.0_11-b12 +jit [darwin-x86_64] | |
[~/work/hypermicrodata]$ bundle exec gem list | grep nokogiri | |
nokogiri (1.6.3.1 java) | |
[~/work/hypermicrodata]$ cat test/data/example.html | |
<!doctype html> | |
<html> | |
<!-- shameless --> | |
<head> | |
<title>Jason Ronallo</title> |
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 "active_record" | |
require "faker" | |
ActiveRecord::Base.establish_connection( | |
adapter: "postgresql", | |
host: "localhost", | |
username: "username", | |
password: "password", | |
database: "sample_db" | |
) |
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 "benchmark" | |
test_string = "test string" | |
n = 1_000_000 | |
Benchmark.bmbm { |x| | |
x.report("normal") { n.times { test_string.length } } | |
x.report("send") { n.times { test_string.send(:length) } } | |
x.report("eval") { n.times { eval "test_string.length" } } | |
} |
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
# itの中に puts @smith を加えると、それぞれのitのなかで返ってくる @smith オブジェクトは異なる。 | |
# ただし、puts @smith.inspectとするとそれぞれが同じ値を持っていて、同じオブジェクトのように思える。 | |
require 'spec_helper' | |
describe Contact do | |
# 省略 | |
describe "filter last name by letter" do | |
before :each do | |
@smith = Contact.create(firstname: 'John', lastname: 'Smith', |