Skip to content

Instantly share code, notes, and snippets.

View tanish-kr's full-sized avatar
🏠
Working from home

Tatsunori Nishikori tanish-kr

🏠
Working from home
View GitHub Profile
@tanish-kr
tanish-kr / docer-machine-create
Created January 5, 2016 14:41
boot2dockerのイメージからdocker-machineへmigrateする ref: http://qiita.com/kitaro_tn/items/17b5394f7386c624d6c1
$ docker-machine create -d virtualbox --virtualbox-import-boot2docker-vm boot2docker-vm docker-vm
@tanish-kr
tanish-kr / file0.txt
Last active May 11, 2017 03:03
gitでもっと早く使っておけばよかったコマンド・オプション ref: http://qiita.com/kitaro_tn/items/8e05d249729967b4597f
$ git log --graph
@tanish-kr
tanish-kr / file0.txt
Created February 15, 2016 02:50
git flow initコマンド prefixの消し方 ref: http://qiita.com/kitaro_tn/items/a021bdc2ef453b014261
$ git flow init
Branch name for production releases: [master]
Branch name for "next release" development: [develop]
Feature branches? [feature/]
Release branches? [release/]
Hotfix branches? [hotfix/]
Support branches? [support/]
Version tag prefix? [] v1
array = [1, 2, 3]
# The `*` is interpreted as a splat operator but it could possibly be
# a `*` method invocation (i.e. `do_something.*(array)`).
do_something *array
# With parentheses, there's no ambiguity.
do_something(*array)
@tanish-kr
tanish-kr / sample_exception.rb
Created April 13, 2016 14:37
ruby custom exception
# coding: utf-8
require 'logger'
require 'json'
ENV["TZ"] = "Asia/Tokyo"
##
# 自作logger class
class MyLogger < Logger
@tanish-kr
tanish-kr / file0.txt
Created April 24, 2016 13:27
ansible2系で起こったバグの一部紹介 ref: http://qiita.com/kitaro_tn/items/6f9dc92d12bcd74b4443
# yum groupinstall "Development Tools"
@tanish-kr
tanish-kr / dynamic_method.md
Created May 12, 2016 10:22
動的メソッド追加パフォーマンス検証
# coding: utf-8 

require 'benchmark'

module IncludeMethod

  ##
  # other instance method include your class
  def include_instance_method_org(instance, method_names)
@tanish-kr
tanish-kr / custom_strategy.rb
Last active June 12, 2016 04:53
idのauto_increment, 日付自動挿入, delete_flag自動設定のFactoryGirl custom strategy
# coding: utf-8
require 'singleton'
module CustomStrategy
class AutoIncrement
include Singleton
@tanish-kr
tanish-kr / build.rb
Created June 12, 2016 05:21
factory_girlでcustom strategyを作るTips ref: http://qiita.com/kitaro_tn/items/6200cbabbbea0c1ac168
module FactoryGirl
module Strategy
class Build
def association(runner)
runner.run
end
def result(evaluation)
evaluation.object.tap do |instance|
evaluation.notify(:after_build, instance)
@tanish-kr
tanish-kr / file0.txt
Created September 15, 2016 12:11
[ActiveRecord]activerecord-import-0.15系で気をつけること ref: http://qiita.com/kitaro_tn/items/a687b87d958660db3545
result = model_module.import instance_arr
if !result.failed_instances.blank?
logger.warn(result.failed_instances)
end