Skip to content

Instantly share code, notes, and snippets.

View pchw's full-sized avatar

Hiroshi HORIKI pchw

View GitHub Profile
@pchw
pchw / AppDelegate.xib
Created May 20, 2012 11:06
TwiConのSourceを極力Resourceを書き換えずにRubyMotionで書きなおすのを試したコード.Rakefileで初めに読み込むnibファイルを指定し,IBOutletに当たるものはgetter/setterをattr_accessorで生成することで実現.
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1280</int>
<string key="IBDocument.SystemVersion">11E53</string>
<string key="IBDocument.InterfaceBuilderVersion">2182</string>
<string key="IBDocument.AppKitVersion">1138.47</string>
<string key="IBDocument.HIToolboxVersion">569.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
@pchw
pchw / AutoHotKey.ahk
Created May 22, 2012 03:17
AutoHotKey(JIS->US)
Alt & Space::Send, {vkF3sc029} ;Alt+Space->IME ON/OFF
#UseHook ; Needed for remapping keys to each other, e.g. A becomes B, and B becomes A.
SetStoreCapslockMode Off ; Optional. Allows Capslock to be ON to send remapped keys in uppercase.
+VKF4::~
VKF4::`
VKF3::`
+2::Send,{@}
+6::Send,{^}
@pchw
pchw / Gemfile
Created May 26, 2012 09:19
AppReviewViewer用のGemfile
source :rubygems
gem 'json'
gem 'nokogiri'
gem 'sequel'
gem 'sqlite3'
gem 'sinatra'
gem 'sinatra-reloader'
gem 'sinatra-sequel'
@pchw
pchw / gist:2882922
Created June 6, 2012 16:04
call resignFirstResponder for nil
class NilClass
def method_missing(method, *args, &block)
if method.to_s == "resignFirstResponder"
return nil
else
super
end
end
end
@pchw
pchw / gist:3933453
Created October 22, 2012 19:10
use sinon.stub for a method has callback argument
should = require 'should'
sinon = require 'sinon'
class Hoge
fuga: (params, callback)->
return callback(params)
class Fuga
moge: (params, dummy, callback)->
return callback(params)
@pchw
pchw / .bashrc
Created October 23, 2012 03:46
dot bashrc
source ~/nvm/nvm.sh
alias ls='ls -G'
# brew install git bash-completion
if [ -f `brew --prefix`/etc/bash_completion ]; then
. `brew --prefix`/etc/bash_completion
fi
GIT_PS1_SHOWDIRTYSTATE=true
@pchw
pchw / undefined.js
Created January 30, 2013 04:46
test.level1.level2.level3 is undefined or not?
var test = {};
var level3 = (((test || {}).level1 || {}).level2 || {}).level3 || 'no key';
console.log( level3 ); // no key
test.level1 = {};
test.level1.level2 = {};
test.level1.level2.level3 = "level3";
level3 = (((test || {}).level1 || {}).level2 || {}).level3;
console.log( level3 ); // "level3"
var s = require('./index').service;
var submod = require('./index').submod;
s.hoge();
submod.hoge();
@pchw
pchw / hub_partial.rb
Created March 31, 2013 04:20
pull requestしたらopenするようにする変更
# $ hub pull-request
# $ hub pull-request "My humble contribution"
# $ hub pull-request -i 92
# $ hub pull-request https://github.com/rtomayko/tilt/issues/92
def pull_request(args)
args.shift
options = { }
force = explicit_owner = false
base_project = local_repo.main_project
head_project = local_repo.current_project
@pchw
pchw / 2013_watch_anime_Apr.md
Last active December 16, 2015 03:09
春アニメの見る見ない

2013春アニメ観る観ない

見る

  1. はたらく魔王様
  2. 変態王子
  3. 進撃の巨人
  4. あいうら
  5. デビサバ2
  6. 翠星のガルガンディア
  7. ヴヴヴ