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
# 文字列型のカラムのデータを検証前にstripする | |
concern :StringStripper do | |
included do | |
# self.columnsはテーブルのスキーマ情報からロードされるため、テーブルがまだないときは何もしない | |
proc = if ActiveRecord::VERSION::MAJOR > 4 | |
Proc.new { ActiveRecord::Base.connection.data_source_exists? self.table_name } | |
else | |
Proc.new { ActiveRecord::Base.connection.table_exists? self.table_name } | |
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
module Capybara | |
module Node | |
module Actions | |
def new_click_button(locator=nil, options={}) | |
locator, options = nil, locator if locator.is_a? Hash | |
begin | |
find(:button, locator, options).click | |
rescue Capybara::Poltergeist::MouseEventFailed => e | |
find(:button, locator, options).trigger('click') | |
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
set -x PATH $HOME/.anyenv/bin $PATH | |
# eval (anyenv init - fish) # not working... | |
# rbenv | |
set -x RBENV_ROOT "$HOME/.anyenv/envs/rbenv" | |
set -x PATH $PATH "$RBENV_ROOT/bin" | |
set -gx PATH "$RBENV_ROOT/shims" $PATH | |
set -gx RBENV_SHELL fish | |
source "$RBENV_ROOT/libexec/../completions/rbenv.fish" |
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 peco_kill --description="Kill selected process by peco" | |
if set -q $argv | |
ps aux | peco | read proc | |
else | |
ps aux | peco --query $argv | read proc | |
end | |
if test -n "$proc" | |
set -l pid (echo $proc | awk '{print $2}') | |
echo "kill pid: $pid. [$proc]" | |
kill $pid |
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
alias bi 'bundle install' | |
alias be 'bundle exec' | |
alias bu 'bundle update' | |
alias ll 'ls -lh' |
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 fish_user_key_bindings | |
bind \cr peco_select_history | |
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 'optparse' | |
options = { | |
line: false, | |
job_name: 'build', | |
branch: nil, | |
vcs_type: :github | |
} | |
OptionParser.new do |opts| |
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
ko.bindingHandlers.recaptcha = { | |
init: function(element, valueAccessor, allBindings, viewModel, bindingContext) { | |
var propWriters = allBindings()['_ko_property_writers']; | |
var value = valueAccessor(); | |
document.addEventListener('createCaptcha', function(event, theme) { | |
var site_key = document.querySelector('.g-recaptcha').dataset.sitekey | |
var callback = allBindings.get('recaptchaCallback') || function () { | |
if (!value) { | |
if (ko.isObservable(value)) { | |
value = true |
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
#!/usr/bin/env ruby | |
require 'optparse' | |
require 'json' | |
options = { | |
number: nil | |
} | |
OptionParser.new do |opts| |
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 peco_git_commit --description="Select git commit message by history" | |
if set -q $argv | |
history | peco | read line | |
else | |
history | peco --query $argv | read line | |
end | |
if test -n "$line" | |
commandline "git commit -m \"$line\"" | |
end | |
set -e line |