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
#!/usr/bin/env ruby | |
class AlreadyExistsStone < StandardError; end | |
def init_board(num = 19) | |
@board = Array.new(num){ Array.new(num) } | |
end | |
def init_narabe(num = 5) | |
@narabe = num |
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
source 'https://rubygems.org' | |
group :development, :test do | |
gem 'pry' | |
gem 'pry-doc' | |
gem 'pry-byebug' | |
gem 'pry-power_assert' | |
end | |
group :test do |
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
module FullErrorMessages | |
extend ActiveSupport::Concern | |
# includes errors on this model as well as any nested models | |
def all_error_messages | |
messages = self.errors.messages.dup | |
messages.each do |column, errors| | |
if self.respond_to?(:"#{column}_attributes=") && (resource = self.send(column)) | |
messages[column] = resource.errors.messages | |
end |
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
git filter-branch --commit-filter ' | |
if [ "$GIT_AUTHOR_NAME" = "Hajime Kimura" ]; | |
then | |
GIT_AUTHOR_NAME="nalabjp"; | |
GIT_AUTHOR_EMAIL="[email protected]"; | |
GIT_COMMITTER_NAME="nalabjp"; | |
GIT_COMMITTER_EMAIL="[email protected]"; | |
git commit-tree "$@"; | |
else | |
git commit-tree "$@"; |
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
#Deploy and rollback on Heroku in staging and production | |
%w(staging production).each do |app| | |
desc "Deploy to #{app}" | |
task "deploy:#{app}" => %W(deploy:set_#{app}_app deploy:push deploy:env deploy:restart deploy:tag app:logs) | |
desc "Deploy #{app} with migrations" | |
task "deploy:#{app}:migrations" => %W(deploy:set_#{app}_app deploy:push deploy:off deploy:migrate deploy:env deploy:restart deploy:on deploy:tag app:logs) | |
desc "Rollback #{app}" |
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
$stdout.sync = true | |
DB_CONFIG = 'config/database.yml' | |
SCHEMA_FILE = 'db/Schemafile' | |
SCHEMA_DUMP_FILE = "#{SCHEMA_FILE}.dump" | |
OPT_ENV = "--env #{Rails.env}" | |
OPT_CONFIG = "--config #{DB_CONFIG}" | |
OPT_FILE = "--file #{SCHEMA_FILE}" | |
OPT_MYSQL_AWESOME = '--enable-mysql-awesome --mysql-awesome-unsigned-pk' | |
OPT_APPLY = '--apply' |
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
if ENV['COVERAGE'] | |
require 'simplecov' | |
require 'simplecov-rcov' | |
SimpleCov.merge_timeout 3600 | |
SimpleCov.formatters = [ | |
SimpleCov::Formatter::HTMLFormatter, | |
SimpleCov::Formatter::RcovFormatter | |
] | |
SimpleCov.start 'rails' | |
end |
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
# Description: | |
# Post gitlab related events using gitlab hooks | |
# | |
# Dependencies: | |
# "url" : "" | |
# "querystring" : "" | |
# | |
# Configuration: | |
# GITLAB_CHANNEL | |
# GITLAB_DEBUG |
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
<?xml version="1.0"?> | |
<root> | |
<appdef> | |
<appname>SLACK</appname> | |
<equal>com.tinyspeck.slackmacgap</equal> | |
</appdef> | |
<item> | |
<name>For Slack CTRL+N=move next channel, CTRL+P=move previous channel, ALT+A=move unread channel</name> | |
<identifier>private.app_slack_move_channel_with_ctrln_ctrlp</identifier> | |
<only>SLACK</only> |
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
#!/bin/sh | |
[ -f /opt/boxen ] && rm -fr /opt/boxen | |
sudo rm -fr /opt/boxen | |
sudo mkdir -p /opt/boxen | |
sudo chown $USER:admin /opt/boxen | |
git clone https://github.com/nalabjp/our-boxen /opt/boxen/repo | |
/opt/boxen/repo/script/boxen --no-fde | |
echo '# boxen' >> ~/.bash_profile | |
echo '[ -f /opt/boxen/env.sh ] && source /opt/boxen/env.sh' >> ~/.bash_profile |