This file contains 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 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 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 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 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 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 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
#-*- coding: utf-8 -*- | |
require 'benchmark' | |
# When you convert a jpg image using ImageMagick, | |
# convert command options combination make a big difference in performance. | |
# so i try to do a benchmark test about parameter combination. | |
# | |
# Fastest combination : when given define option with width and height. | |
# Secondary combination : when given define with either width or height, debug option make faster. |
This file contains 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
# gnome-tweak | |
sudo add-apt-repository ppa:tualatrix/next | |
sudo apt-get update | |
sudo apt-get install ubuntu-tweak | |
# icon set | |
sudo add-apt-repository ppa:tiheum/equinox | |
sudo apt-get update | |
sudo apt-get install faenza-icon-theme |
This file contains 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
$ gem install -v 1.3.7 rubygems-update | |
$ update_rubygems |
This file contains 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
$ sudo apt-get install gtk2-engines-pixbuf |