Skip to content

Instantly share code, notes, and snippets.

View yamaya's full-sized avatar

Masayuki Yamaya yamaya

  • Sapporo, Hokkaido, Japan
View GitHub Profile
@yamaya
yamaya / .gvimrc
Created April 13, 2012 12:13
MacVimでCommand+[+-]でフォントサイズを変える
" guifontオプションは"フォント名:hフォント高"の形式で設定しておく必要がある
function! ResizeFontGetGuiFontOption()
let matches = matchlist(&guifont, '\(.*\):h\(\d\+\)\(:.*\)\?')
if empty(matches) && matches[2] == ''
return {}
endif
return {'name': matches[1], 'size': matches[2], 'opts': matches[3]}
endfunction
function! ResizeFontBy(amount)
let font = ResizeFontGetGuiFontOption()
@yamaya
yamaya / p.coffee
Created April 19, 2012 15:27
"p" function likes ruby
p = (thing)->
stringnize = (obj)->
switch typeof_(obj)
when 'Null'
return 'nil'
when 'Object'
return "{#{(":#{k} => #{stringnize(v)}" for k, v of obj).join(', ')}}"
when 'Array'
return "[#{(stringnize(e) for e in obj).join(', ')}]"
else
@yamaya
yamaya / typeof_.coffee
Created April 19, 2012 15:28
extended "typeof" function
typeof_ = (thing)->
if thing is null
'Null' # Special case
else
Object.prototype.toString.call(thing).match(/^\[object\s(.*)\]$/)[1]
@yamaya
yamaya / gist:2853897
Last active October 5, 2015 18:29
Run iPhone Simulator with target .app from the command line
#!/bin/bash
# NOTE: $1 must be absolute path.
open -a `xcode-select -print-path`/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app --args -SimulateApplication $1
osascript 2>/dev/null <<EOF
tell application "System Events"
tell process "iPhone Simulator" to keystroke "2" using command down
end
EOF
@yamaya
yamaya / xcode-clang-vers
Last active April 3, 2024 02:28
Xcode clang version record
# Xcode 4.3.3
Apple clang version 3.1 (tags/Apple/clang-318.0.61) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.0
Thread model: posix
# Xcode 4.3.2
Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.0
Thread model: posix
@yamaya
yamaya / gist:4333810
Created December 19, 2012 02:13
Xcode Organaizer からダウンロードされているプロビジョニングプロファイルを削除する方法
$ rm -rf ~/Library/MobileDevice/Provisiong\ Profile
# KeychainからProvisiong Profileに対応する証明書を削除する
$ defaults delete com.apple.dt.Xcode DTDKPortalCache
@yamaya
yamaya / private.xml
Last active December 10, 2015 17:18
KeyRemap4MacBookのprivate.xml
<?xml version="1.0"?>
<root>
<deviceproductdef>
<productname>KENSINGTON_USB_PS2_EXPERT_MOUSE</productname>
<productid>0x1015</productid>
</deviceproductdef>
<deviceproductdef>
<!-- MacBook Pro 15-inch Late 2008 -->
<productname>APPLE_INTERNAL_KEYBOARD_TRACKPAD_0x0238</productname>
<productid>0x0238</productid>
@yamaya
yamaya / clang-options
Last active December 11, 2015 02:59
iOS SDKをclangでcode-completionする場合に必要な最小設定 with iPhoneSimulator
-arch x86_64
-fmacro-backtrace-limit=0
-std=gnu99
-fblocks
-fobjc-arc
-fmodules
-mios-simulator-version-min=8.0
-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk
-D DEBUG
-I Pods/Headers
@yamaya
yamaya / after_ftplugin_objc.vim
Last active December 11, 2015 16:58
VimからXcodeでActiveなtargetをRunする
function! <SID>XcodeRunCurrentTarget()
let l:apple_script = 'tell application "Xcode"'
\. "\n". ' activate'
\. "\n". ' tell application "System Events"'
\. "\n". ' key code 15 using {command down}'
\. "\n". ' end tell'
\. "\n". 'end tell'
call system(printf("osascript -e '%s'", l:apple_script))
endfunction
nnoremap <buffer> <F5> :call <SID>XcodeRunCurrentTarget()<CR>
@yamaya
yamaya / autocmd.vim
Last active December 25, 2015 21:19
MacBookでMacVimしていると手のひらがTrack Padに触れてウザイのをなんとかする。要 KeyRemap4MacBook
" MacVimの起動時、アプリケーション切り替え時にKeyRemap4MacBookコマンドラインを実行してポインティング・デバイスを有効・無効にする
let g:keyremap4macbook_cmd = '/Applications/KeyRemap4MacBook.app/Contents/Applications/KeyRemap4MacBook_cli.app/Contents/MacOS/KeyRemap4MacBook_cli'
let g:keyremap4macbook_pointing_device_ignoring_cmd = g:keyremap4macbook_cmd . ' set notsave.private.pointing_device_ignoring '
augroup VimrcEx
autocmd!
" ポインティング・デバイスの有効・無効
autocmd FocusGained,VimEnter *
\ let out = system(g:keyremap4macbook_pointing_device_ignoring_cmd . '1')
\| if out != '' | echoerr out | endif