Skip to content

Instantly share code, notes, and snippets.

View vochicong's full-sized avatar
🐒
NLP/ML/AI

Cong vochicong

🐒
NLP/ML/AI
View GitHub Profile
費用 PMI会員 一般
PMI会員年会費 $129 ---
PMP資格試験 $405 $555
PMP資格更新 $60 $150
ACP資格試験 $435 $495
ACP資格更新 $60 $150
# Oh My Zshでstatusを表示しない
git config --add oh-my-zsh.hide-status 1
# Oh My Zshでstatusを表示する
git config --add oh-my-zsh.hide-status 0
@vochicong
vochicong / .overcommit.yml
Created March 21, 2018 21:43
Overcommit+Pronto+個別チェッカーで変なRubyコード(変更分+新規分)をコミットさせない ref: https://qiita.com/vochicong/items/b63d573dbdc24dfe02ad
PreCommit:
CustomScript:
enabled: true
command: ['bin/precommit.sh']
@vochicong
vochicong / CI_PULL_REQUESTSから関連PRのIDを(複数)取り出す
Last active March 21, 2018 21:52
CircleCIでGitHub上のPRを自動コードレビュー(master, develop以外任意の統合先ブランチにも対応) ref: https://qiita.com/vochicong/items/2008bfe045c216c0ad3a
# CI_PULL_REQUESTSから関連PRのIDを(複数)取り出す
def pr_ids(pr_id = nil)
ids = ENV.fetch('CI_PULL_REQUESTS', '').split(',').map { |url| pr_id url }
ids.push pr_id if pr_id
ids
end
# PRのURLから、最後の数値列を取り出しPRのIDとする
def pr_id(pr_url)
pr_url[/\d+$/].to_i
@vochicong
vochicong / Gemfile
Last active March 28, 2019 11:14
Pronto, Octokit を使って、CircleCI からGitHubでホストしているRailsプロジェクトのPRに対してコードレビューを実施
# ProntoのチェッカーをGemfileに指定してインストール
group :development, :test do
# Pronto: auto code review
gem 'pronto-rubocop', require: false
gem 'pronto-reek', require: false
gem 'pronto-flay', require: false
end
@vochicong
vochicong / 25_nginx.config
Created February 12, 2018 08:17
EB setting to make nginx look at assets in public/packs
# .ebextensions/25_nginx.config
# By default, Webpacker/Rails will compile assets into public/packs,
# but nginx by EB default settings doesn't look at that folder.
files:
"/etc/nginx/conf.d/rails-webpack.conf" :
# Modified from /etc/nginx/conf.d/webapp_healthd.conf
mode: "000644"
owner: root
group: root
content: |
@vochicong
vochicong / file0.txt
Last active January 8, 2018 02:47
Cloud Datalabで手軽にディープラーニングを始める ref: https://qiita.com/vochicong/items/91e5c920f994cf60eabb
brew cask install google-cloud-sdk
gcloud components install datalab
@vochicong
vochicong / file0.txt
Last active March 23, 2019 15:57
brew bundleでMacのアプリをまとめてインストール・管理 ref: https://qiita.com/vochicong/items/f20afc89a6847cd58f0f
# Brewfile
cask_args appdir: "/Applications"
tap "caskroom/cask"
tap "homebrew/bundle"
tap "homebrew/core"
cask "google-chrome"
cask "slack"
cask "github"
brew "git"
@vochicong
vochicong / after_rubo51.rb
Last active December 31, 2017 07:13
rubocop 0.51のStyle/SafeNavigation (&.)の重大バグ ref: https://qiita.com/vochicong/items/8f21d6045fab0d87f4fe
# rubocop v0.51 の変換結果、正しい
if user&.group&.admin?
puts 'userが管理者です'
else
puts 'userがnilか、管理者ではないです'
end
# rubocop v0.51は以下の様に間違って変換
if !user&.group&.admin?
puts 'userが普通ユーザです'
# File: config/initializers/params_snakeizer.rb
# Transform JSON request param keys from JSON-conventional camelCase to
# Rails-conventional snake_case
module ActionController
# Modified from action_controller/metal/strong_parameters.rb
class Parameters
def deep_snakeize!
@parameters.deep_transform_keys!(&:underscore)
self
end