Skip to content

Instantly share code, notes, and snippets.

View rhysd's full-sized avatar
🐾
Fixing an off-by-wan error

Linda_pp rhysd

🐾
Fixing an off-by-wan error
View GitHub Profile
@rhysd
rhysd / .vimrc
Created October 7, 2012 10:29
良い感じに要らなくなったウィンドウを閉じてくれそうな設定.
" ウィンドウ周りのユーティリティ "{{{
function! s:close_window(winnr)
if winbufnr(a:winnr) !=# -1
execute a:winnr . 'wincmd w'
execute 'wincmd c'
return 1
else
return 0
endif
endfunction
@rhysd
rhysd / .vimrc
Created October 7, 2012 18:00
犬小屋(試験場)
let s:into_doghouse = 1
if exists('s:into_doghouse') && filereadable($HOME."/.doghouse.vimrc")
try
source $HOME/.doghouse.vimrc
catch
" エラーメッセージの表示
echohl ErrorMsg
let msg =
\ "an error occurred... starting as debug mode.\n"
\ . "\n"
@rhysd
rhysd / doghouse.vim
Created October 8, 2012 09:38
Tweet バッファ
function! s:update_status()
if ! has('ruby')
return
endif
if ! filereadable(expand('~/.credential.yml'))
echoerr "There are no keys to authenticate."
return
endif
ruby << EOF
@rhysd
rhysd / ks
Created October 15, 2012 06:55
ls を ks に typo したとき用ジョークプログラム(Mac 限定)
#!/bin/sh
# this is a kidding.
# I often mistype `ls` as `ks`.
# Be sure to install Kyoko's voice before installing this script.
which say > /dev/null && say -v Kyoko "打ち間違えてんじゃねえよカス!" &
ls "$@"
@rhysd
rhysd / erutaso.rb
Created October 30, 2012 16:44
私,どうしてこんなことしてるんでしょう.気になります!
#!/usr/bin/env ruby
# encoding: utf-8
alphas = %w[ えー びー しー でぃー いー えふ じー えっち あい じぇー けー える えむ えぬ おー ぴー きゅー あーる えす てぃー ゆー ぶい だぶりゅー えっくす わい ずぃー ]
arufas = {}
('a'..'z').zip(alphas).each{|k,v| arufas[k] = v}
def num2kan(n)
raise if n > 9999
#!/usr/bin/env ruby
# encoding: utf-8
#
# main
#
if __FILE__ == $0
Thread.new do
sleep 3
@rhysd
rhysd / hoge.rb
Created November 12, 2012 02:26
あれ,これってもしかしてデフォルト引数必須…?
#!/usr/bin/env ruby
# encoding: utf-8
def test(tsura: 'poyo', yaba: 'poyo')
puts tsura+yaba
end
test #=> poyopoyo
test tsura: 'tsura' #=> tsurapoyo
test yaba: 'yaba' #=> poyoyaba
@rhysd
rhysd / hoge.rb
Created November 12, 2012 02:27
あれ,これってもしかしてデフォルト引数必須…?
#!/usr/bin/env ruby
# encoding: utf-8
def test(tsura: 'poyo', yaba: 'poyo')
puts tsura+yaba
end
test #=> poyopoyo
test tsura: 'tsura' #=> tsurapoyo
test yaba: 'yaba' #=> poyoyaba
@rhysd
rhysd / hogepoyo
Created November 18, 2012 14:28
vim-vspec で使ってる便利なコマンド.runnner を vimproc にするとすごく遅いのでデフォルトにしてる.
" vim-vspec 用コマンド {{{
command! -nargs=0 Vspec
\ execute 'QuickRun' 'sh' '-src'
\ '''$HOME/.vim/bundle/vim-vspec/bin/vspec $HOME/.vim/bundle/vim-vspec '.expand('%:p').''''
" }}}
@rhysd
rhysd / hogepoyo.vim
Created November 18, 2012 14:29
vim-vspec で使ってる便利なコマンド.runnner を vimproc にするとすごく遅いのでデフォルトにしてる.
" vim-vspec 用コマンド {{{
command! -nargs=0 Vspec
\ execute 'QuickRun' 'sh' '-src'
\ '''$HOME/.vim/bundle/vim-vspec/bin/vspec $HOME/.vim/bundle/vim-vspec '.expand('%:p').''''
" }}}