This file contains hidden or 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
file = File.open("filename","r") | |
2.times { file.gets.chomp } | |
data = "" | |
while data = file.gets | |
puts data | |
end |
This file contains hidden or 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
#!/bin/sh | |
# iedevのVim勉強会(http://atnd.org/events/30822)用のスクリプト。 | |
# vunldeとref.vimをインストール + webdict周りの設定をします。 | |
# git と w3m は用意しておいてください | |
# git のチェック | |
which git > /dev/null | |
if [ $? -ne 0 ]; then | |
echo git not found. please install git. | |
exit |
This file contains hidden or 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
hg clone http://vim.googlecode.com/hg vim | |
cd vim | |
./configure --enable-multibyte | |
make | |
make test | |
sudo make install | |
cd .. | |
rm -rf vim |
This file contains hidden or 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
.vimrcにこの行を追加 | |
autocmd BufNewFile *.rb 0r ~/.vim/templates/ruby.rb "ruby | |
~/.vim/templates/ruby.rb に下の行だけのファイルを作る | |
# -*- coding: utf-8 -*- |
This file contains hidden or 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 -*- | |
# method { ... } だと | |
# ブロックを渡してるのかハッシュを渡してるのか、ってなるので | |
# ハッシュを渡したい時は {} を省略して良いらしい | |
def puts_hash_hoge hash | |
puts hash[:hoge] | |
end | |
puts_hash_hoge :hoge => "hogehoge" , :fuga => "fugafuga" |
This file contains hidden or 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 -*- | |
# ハッシュの中に配列 | |
array_in_hash = {:hoge => [1,2] , :fuga => [3,4]} | |
# keyを渡すと配列が返ってくる | |
p array_in_hash[:hoge] # => [1, 2] | |
# その配列の0番目 | |
p array_in_hash[:hoge][0] # => 1 |
This file contains hidden or 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
# 0 から 5 まで出力 | |
(0..5).each do |num| | |
if num == 3 | |
next # 3だけ飛ばす | |
end | |
puts num | |
end |
This file contains hidden or 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
:compiler ruby | |
:make -c % | |
した時のquickfix | |
hoge.rb|1 error| syntax error, unexpected '{', expecting '\n' or ';' | |
hoge.rb|2 error| unterminated string meets end of file |
This file contains hidden or 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
\ "watchdogs_checker/ruby" : { | |
\ "command" : "ruby", | |
\ "exec" : "%c %o -c %s:p", | |
\ "quickfix/errorformat" : "%E%f:%l:\ %m", | |
\ }, |
This file contains hidden or 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
{ | |
'args': '', | |
'cmdopt': '', | |
'command': 'ruby', | |
'exec': '%c %o -c %s:p', | |
'hook/hier_update/enable_exit': 1, | |
'hook/output_config/enable_module_loaded': '1', | |
'hook/output_config/log': '1', | |
'hook/quickfix_replate_tempname_to_bufnr/enable_exit': 1, | |
'hook/quickfix_replate_tempname_to_bufnr/priority_exit': -10, |