Skip to content

Instantly share code, notes, and snippets.

View masui's full-sized avatar

Toshiyuki Masui masui

View GitHub Profile
@masui
masui / gist:997648
Created May 29, 2011 10:55
(練習)

gistで文章書きだと

MarkDownが使える

Gyazzで書く方が便利な気がするけど

  • aaa

  • bbb

      main(){
        ruby;
    

}

@masui
masui / gist:1333288
Created November 2, 2011 09:54
Find the newest OmniGraffle document on Mac with Spotlight+MacRuby
#
# Find the newest OmniGraffle document
#
framework 'Cocoa'
def finish(notification)
if @query.resultCount > 0 then
puts @query.resultAtIndex(0).valueForAttribute('kMDItemPath')
end
@masui
masui / gist:1335617
Created November 3, 2011 02:30
Find large Microsoft Word documents on Mac with Spotlight+MacRuby
#
# List large Microsoft Word files upto 10
#
framework 'Cocoa'
def finish(notification)
max = @query.resultCount
max = 10 if max > 10
(0...max).each { |i|
@masui
masui / gist:1335651
Created November 3, 2011 02:54
jQueryで<input>タグのvalue値を取得する方法
// jQueryで<input>タグのvalue値を取得する方法
// value()ではないことに注意
val = $('#input').val();
@masui
masui / README.md
Created January 4, 2012 03:00
清一色のあらゆる手牌出力/アガり判定

生成

% ruby gen.rb

判定

% ruby gen.rb | ruby check.rb
% ruby gen.rb | ruby check2.rb
webView.setWebChromeClient(new WebChromeClient() {
public boolean onConsoleMessage(ConsoleMessage cm){
Log.v("TestWebViewApp", cm.message()+" -- line:"+cm.lineNumber()+" of "+cm.sourceId());
return true;
}
});
@masui
masui / gist:2165433
Created March 22, 2012 23:22
RubyでAmazon S3アクセス
require 'rubygems'
require 'aws/s3'
include AWS::S3
Base.establish_connection!(
:access_key_id => 'ABCDEFG',
:secret_access_key => 'abcdefg'
)
DEFAULT_HOST.replace "s3-ap-northeast-1.amazonaws.com" # 東京を指定
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>URL</key>
<string>vnc://gyazz.com</string>
</dict>
</plist>
// validation
$('.zip .editable').editable('click', function(e){
if(e.value.match(/^\d{3}\-\d{4}$/)){
alert(e.target.selector + ' : ' + e.value);
}
else{
$('.zip .editable').html(e.old_value);
alert(e.value + ' is not valid zip-code');
}
});
(function($){
$.fn.yourfunc = function(/* 適当な引数 */){
/* 適当に処理 */
return this;
};
})(jQuery)