require 'open-uri' require 'timeout' require 'json' def coderwall(name, size = [60, 60]) begin cache = "#{@cache_path}/coderwall.json" json = File.read(cache) File::delete(cache) if Time::now > File::mtime( cache ) + 60*60*24 rescue Errno::ENOENT begin Timeout.timeout(10) do json = open( "https://coderwall.com/#{name}.json" ) {|f| f.read } end open(cache, 'wb') {|f| f.write(json) } rescue Timeout::Error return "" end end html = '