Skip to content

Instantly share code, notes, and snippets.

@taf2
Created December 20, 2009 00:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taf2/260285 to your computer and use it in GitHub Desktop.
Save taf2/260285 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'curb'
def concat_to_file(urls,save_path)
downloads = {}
Curl::Multi.get(urls) {|easy| downloads[easy.url] = easy.body_str }
puts "saving #{urls.inspect} to #{save_path.inspect}"
File.open(save_path,"wb"){|f| urls.each {|url| f << downloads[url] } }
end
concat_to_file ["http://yui.yahooapis.com/2.8.0r4/build/yahoo-dom-event/yahoo-dom-event.js",
"http://yui.yahooapis.com/2.8.0r4/build/animation/animation-min.js",
"http://yui.yahooapis.com/2.8.0r4/build/element/element-min.js",
"http://yui.yahooapis.com/2.8.0r4/build/container/container-min.js",
"http://yui.yahooapis.com/2.8.0r4/build/menu/menu-min.js",
"http://yui.yahooapis.com/2.8.0r4/build/button/button-min.js",
"http://yui.yahooapis.com/2.8.0r4/build/editor/editor-min.js"], "/Users/taf2/yui280r4.js"
concat_to_file ["http://yui.yahooapis.com/2.8.0r4/build/menu/assets/skins/sam/menu.css",
"http://yui.yahooapis.com/2.8.0r4/build/button/assets/skins/sam/button.css",
"http://yui.yahooapis.com/2.8.0r4/build/fonts/fonts-min.css",
"http://yui.yahooapis.com/2.8.0r4/build/container/assets/skins/sam/container.css",
"http://yui.yahooapis.com/2.8.0r4/build/editor/assets/skins/sam/editor.css"], "/Users/taf2/yui280r4.css"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment