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
language: ruby | |
rvm: | |
- 1.9.3 | |
- 2.0.0 | |
before_install: sh travis/before_install.sh | |
script: sh travis/exec_test.sh | |
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
# Install ruby 2.1.2 | |
CONFIGURE_OPTS="--enable-shared --with-readline-dir=`brew --prefix readline` --with-openssl-dir=`brew --prefix openssl`" rbenv install 2.1.2 | |
# Install ruby 2.0.0-p247 | |
CONFIGURE_OPTS="--enable-shared --with-readline-dir=`brew --prefix readline` --with-openssl-dir=`brew --prefix openssl`" rbenv install 2.0.0-p247 | |
# Install ruby 1.9.3-p448 | |
CONFIGURE_OPTS="--enable-shared --with-readline-dir=`brew --prefix readline` --with-openssl-dir=`brew --prefix openssl`" rbenv install 1.9.3-p448 |
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
def remove_color_sequences(text) | |
text.gsub(/\e\[(\d+;)*\d+m/, "") | |
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
SimpleCov.formatter = Coveralls::SimpleCov::Formatter | |
SimpleCov.start do | |
# スペックファイルを除外 | |
add_filter "/spec/" | |
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
# coding: utf-8 | |
require "yaml" | |
def to_flat(key, value) | |
{}.tap do |dic| | |
if value.is_a?(Hash) | |
value.each do |k, v| | |
dic.merge!(to_flat("#{key}.#{k}", v)) | |
end | |
else |
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 | |
module RedmineApp | |
class Application < Rails::Application | |
config.after_initialize do | |
plugin_root_path = File.expand_path(File.join(File.dirname(__FILE__), '../')) | |
Dir.glob(File.join(plugin_root_path, 'config', 'locales', '*.yml')) do |path| | |
if I18n.load_path.include?(path) | |
I18n.load_path.delete(path) | |
I18n.load_path << path | |
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
require "stringio" | |
def capture(stream) | |
begin | |
stream = stream.to_s | |
eval "$#{stream} = StringIO.new" | |
yield | |
result = eval("$#{stream}").string | |
ensure | |
eval "$#{stream} = #{stream.upcase}" |
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
var obj = document.getElementById("obj"); | |
obj.setAttribute("disabled", "disabled"); | |
var child = window.open("child.html", "child window"); | |
child.focus(); | |
var timer; | |
timer = setInterval(function() { | |
if (child.closed) { | |
obj.removeAttribute("disabled"); | |
clearInterval(timer); |
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
" 指定のデータをレジスタに登録する | |
function! s:Clip(data) | |
let @*=a:data | |
echo "clipped: " . a:data | |
endfunction | |
" 現在開いているファイルのパスをレジスタへ | |
command! -nargs=0 ClipPath call s:Clip(expand('%:p')) | |
" 現在開いているファイルのファイル名をレジスタへ | |
command! -nargs=0 ClipFile call s:Clip(expand('%:t')) |
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
class Array | |
# Is self a unique array? | |
def uniq? | |
self.uniq.size == self.size | |
end | |
end |