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(){ | |
alert(); | |
}() |
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
def nest(data, keys, rollup=nil) | |
def recNest(data, keys, rollup=nil) | |
return data if keys.length == 0 | |
data | |
.group_by{|x| keys[0].call(x) } | |
.map{|key, val| | |
d = [recNest(val, keys[1, keys.length - 1], rollup)] | |
d << val.reduce(rollup[0], &rollup[1]) unless rollup.nil? | |
{ key => d.flatten } |
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
def extract_vb_modules(paths) | |
require 'win32ole' | |
excel_app = WIN32OLE.new('Excel.Application') | |
excel_app.ScreenUpdating = false | |
excel_app.EnableEvents = false | |
excel_app.DisplayAlerts = false | |
#excel_app.Calculation = -4135 |
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
def busy(t=10, label="") | |
st = t.kind_of?(Array) ? t[0]+rand(t[1]) : t | |
start = Time.now | |
l = ["|","/","-","\\"] | |
i = 0 | |
while ((Time.now - start)) < st do | |
print "\r", label, l[i] | |
i = (i == 3) ? 0 : i+1 |