Skip to content

Instantly share code, notes, and snippets.

@tmr111116
tmr111116 / README
Created June 6, 2017 13:54
git-flow っぽい git のログから pull requests を再現する。
git-flow っぽい git のログから pull requests を再現する。
```
git log master --reverse --grep 'feature.*into develop' --format='%p %s' --merges --after=2017-03-23 --before=2017-06-01 | ruby -pe "\$_.gsub! /Merge branch '(.+)'.*/, '\\1'"
```
で、特定期間の develop ブランチへマージしたログを切り出す。
これを make_pulls.rb に渡すと、そのマージコミットを再現する pull req を作る。
何かエラーが出たら止まるので手動で対応する。 :innocent:
@tmr111116
tmr111116 / NestCoroutine.cs
Created March 22, 2017 12:25
ネストしたコルーチンを止めてみる。
using System.Collections;
using UnityEngine;
public class NestCoroutine : MonoBehaviour
{
private IEnumerator _coroutine;
private int _count;
private int Count
{
get
@tmr111116
tmr111116 / unityrun.rb
Last active April 16, 2017 14:33
ProjectVersion によって起動する Unity を変えるやつコマンドライン引数対応版。
#!/usr/bin/env ruby
require "yaml"
UNITY_DIR_PREFIX = ENV.fetch("UNITY_DIR_PREFIX", "/Applications/Unity")
unity_args = ARGV.dup
project_path = Dir.getwd
path_arg = ARGV.index("-projectPath")
if path_arg
@tmr111116
tmr111116 / post-merge
Created June 2, 2015 10:17
pull したタイミングで .DS_Store だけが含まれるフォルダを削除する git hook
#!/bin/sh
# pull したタイミングで .DS_Store を消して、 .DS_Store だけが含まれるフォルダを削除する。
#
# まず .DS_Store を削除してから、 .DS_Store が入っていたディレクトリを rmdir する。
# rmdir は空の場合しか削除しないので、中身が入っている場合はそのまま。 grep で不要なエラーメッセージを無視。
find . -name .DS_Store -exec rm {} \; -exec sh -c 'rmdir `dirname {}` 2>&1 | grep -E -v "rmdir:.+: Directory not empty"' \;
@tmr111116
tmr111116 / gist:2ccbbbed1ffe8091df88
Created December 12, 2014 13:53
cocostudio から書き出された JSON の中身を雑に見る。
ruby -r json -e 'def f(o, i=0); oc = o["options"]["classname"]; on = o["options"]["name"]; print " " * i + "#{oc}, #{on}\n"; o["children"].each{|c| f c, i+2}; nil; end; ARGV.each {|j| p j; f JSON.load(open(j).read)["widgetTree"]}' *.json
@tmr111116
tmr111116 / gist:8282663
Created January 6, 2014 13:09
デフォルトの Mac で UTF-8 の BOM をつけるコマンド
cat <(printf "\xEF\xBB\xBF") 元のUTF-8ファイル.txt > BOM付きUTF-8ファイル.txt
@implementation MySharedThing
+ (id)sharedInstance
{
DEFINE_SHARED_INSTANCE_USING_BLOCK(^{
return [[self alloc] init];
});
}
@end
# git の差分表示に使うには .git/info/attributes にこの内容と、
*.mwb diff=MySQLWorkbench
# git config でこれが必要。
# git config diff.MySQLWorkbench.textconv /path/to/mwb.sh
@tmr111116
tmr111116 / .gitignore
Created November 12, 2012 06:11
中身は無視したいけどディレクトリ自体は取っておきたいディレクトリに .gitkeep のかわりに入れる .gitignore
# .gitignore 以外のファイルを全部無視する。
*
!.gitignore
@tmr111116
tmr111116 / .gitconfig
Created October 9, 2012 11:01
zip でアーカイブする git のエイリアス。
[alias]
root = rev-parse --show-toplevel
basename = ! basename `git root`
zip = ! git archive --format=zip --output=`git basename`.zip HEAD