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 archive --format=zip --prefix=projectname/ HEAD `git diff --name-only <commit>` -o archive.zip |
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
Sub MonotonePrint() | |
Dim Current As Worksheet | |
For Each Current In Worksheets | |
' 印刷設定を白黒に | |
Current.PageSetup.BlackAndWhite = True | |
Next | |
' ブック印刷 | |
ActiveWorkbook.Worksheets.PrintOut |
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
// JScript.dll(IE) version check script | |
function getScriptEngineInfo(){ | |
var s = ScriptEngine() + " Version "; | |
s += ScriptEngineMajorVersion() + "." + ScriptEngineMinorVersion() + "." + ScriptEngineBuildVersion(); | |
return(s); | |
} | |
alert(getScriptEngineInfo()); |
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
// repeat character | |
String.prototype.repeat = function(num) { | |
return new Array(num + 1).join(this); | |
} | |
// convert strings and filling zero | |
String.prototype.decimalf = function(num) { | |
if (isNaN(this) || isNaN(num) || num < 0){ return this;}; | |
ary = this.split("."); | |
if(num == 0) { return ary[0]; }; | |
ary[1] = (((ary.length>2)? ary[1] : "") + "0".repeat(num)).substring(0,num); |
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
$(function(){ | |
// same class name jQuery object | |
$('div.some_class'); | |
// these reverse indices jQuery object | |
// Once get indexed objects to array, | |
// Then use Array.reverse() to descending order. | |
// At last, convert array object to jQuery object. | |
$($('div.some_class').get().reverse()); | |
}); |
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
# Array#map | |
def cross(a, b) | |
a.map{|elem_a| b.map{|elem_b| elem_a.to_s + elem_b.to_s}}.flatten | |
end | |
# Array#product | |
def cros(a,b) | |
a.product(b).map{|elem| elem.join()} | |
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
hash = Hash.new{|h,k| h[k] = []} | |
hash[:test] << "Hello" #=> {:test => ["Hello"]} |
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
==> Cloning https://github.com/stevedekorte/io.git | |
Updating /Users/hsato/Library/Caches/Homebrew/io--git | |
git remote set-url origin https://github.com/stevedekorte/io.git | |
git fetch origin | |
git reset --hard | |
HEAD is now at c83f98e Merge pull request #129 from jcowgar/master | |
git checkout-index -a -f --prefix=/private/tmp/homebrew-io-HEAD-VDm0/ | |
==> Downloading patches | |
==> Patching | |
/usr/bin/patch -f -p1 -i 001-homebrew.diff |
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
a = [1,2,3,4,5,6,4,5] | |
a.inject(Hash.new 0) {|h,v| h[v]+= 1;h}.select {|h,v| v >= 2}.keys #=> [4,5] |
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
x = { "one" => "one", "two" => "two", "three" => "three"} | |
y = x.reject {|key,value| key == "three" } | |
y == { "one" => "one", "two" => "two"} |