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
# http://d.hatena.ne.jp/nakamura001/20120824/1345832011 の「複数回実行するとBOMデータが実行しただけ追加されてしまうので必ず1回だけ実行する様に気を付けて下さい。」が気になったので書きなおした。 | |
ruby -e 'ARGV.each{|file|a=open(file).read().gsub(/\A(\xef\xbb\xbf)*/m,"\xef\xbb\xbf"*2);open(file,"w").write(a);}' /Applications/Unity/Unity.app/Contents/Resources/ScriptTemplates/81-C#\ Script-NewBehaviourScript.cs.txt |
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
# 全コミットのチェックサムと、キーワードが削除が表示されるので、キーワードの削除の上の行を見たらどのコミットかわかる。 | |
git log --follow --patch ファイルのパス | grep -E '^commit|^-.*キーワード' | |
# --follow : ファイル名の変更を追跡する。 | |
# --patch : パッチの形式でファイルの差分を表示する。 | |
# grep -E : | をそのまま使いたいので。 | |
# ^commit : どのコミットかわかるように commit で始まる行を表示する。 | |
# ^-.* : 削除だけが見たいので - で始まる行だけを表示する。 |
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] | |
root = rev-parse --show-toplevel | |
basename = ! basename `git root` | |
zip = ! git archive --format=zip --output=`git basename`.zip HEAD |
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
# .gitignore 以外のファイルを全部無視する。 | |
* | |
!.gitignore |
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
# git の差分表示に使うには .git/info/attributes にこの内容と、 | |
*.mwb diff=MySQLWorkbench | |
# git config でこれが必要。 | |
# git config diff.MySQLWorkbench.textconv /path/to/mwb.sh |
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
@implementation MySharedThing | |
+ (id)sharedInstance | |
{ | |
DEFINE_SHARED_INSTANCE_USING_BLOCK(^{ | |
return [[self alloc] init]; | |
}); | |
} | |
@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
cat <(printf "\xEF\xBB\xBF") 元のUTF-8ファイル.txt > BOM付きUTF-8ファイル.txt |
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
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 |
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
#!/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"' \; |
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 "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 |
OlderNewer