Skip to content

Instantly share code, notes, and snippets.

Toshiyuki Masui masui

Block or report user

Report or block masui

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:997648

gistで文章書きだと

MarkDownが使える

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

  • aaa

  • bbb

      main(){
        ruby;
      }
    
@masui
masui / gist:1333288
Created Nov 2, 2011
Find the newest OmniGraffle document on Mac with Spotlight+MacRuby
View gist:1333288
#
# 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 Nov 3, 2011
Find large Microsoft Word documents on Mac with Spotlight+MacRuby
View gist:1335617
#
# 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 Nov 3, 2011
jQueryで<input>タグのvalue値を取得する方法
View gist:1335651
// jQueryで<input>タグのvalue値を取得する方法
// value()ではないことに注意
val = $('#input').val();
@masui
masui / README.md
Created Jan 4, 2012
清一色のあらゆる手牌出力/アガり判定
View README.md

生成

% ruby gen.rb

判定

% ruby gen.rb | ruby check.rb
% ruby gen.rb | ruby check2.rb
View gist:2158482
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 Mar 22, 2012
RubyでAmazon S3アクセス
View gist:2165433
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" # 東京を指定
View gist:2210193
<?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>
View gist:2258965
// 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');
}
});
View gist:2269962
(function($){
$.fn.yourfunc = function(/* 適当な引数 */){
/* 適当に処理 */
return this;
};
})(jQuery)
You can’t perform that action at this time.