Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Cutting off the browser fat from your app

Cutting off the browser fat from your app

Hector Bustillos

October 10, 2013
Tweet

More Decks by Hector Bustillos

Other Decks in Technology

Transcript

  1. Descendant Selectors body header div{ color: blue; } body header

    p{ color: red; } Thursday, October 10, 13
  2. ASYNC & DEFER javascript_tag "alert('All is good')", :defer => 'defer'

    javascript_include_tag "application", :async => true Thursday, October 10, 13
  3. # NOTE: You will need `multipart-post` gem: # $ gem

    install multipart-post   require 'rubygems' require 'json' require 'net/https' require 'net/http/post/multipart'   url = URI.parse("https://api.kraken.io/file") uploadfile = {:name  =>'/Path/To/File.jpg'} auth = { "user"  => "your-kraken-username", "pass"  => "your-kraken-password", "apikey"  => "your-kraken-api-key" }.to_json   File.open(uploadfile[:name]) do  |file| req = Net::HTTP::Post::Multipart.new  url.path, "auth"  => auth, "file"  => UploadIO.new(file, 'logotyp.png')   https = Net::HTTP.new(url.host, url.port) https.use_ssl = true   res = https.start() {|conn| conn.request(req)} response = JSON.parse(res.body)   if  response['success'] puts 'Success. Optimized image URL: '  + response['krakedURL'] else puts 'Fail. Error message: '  + response['error'] end end Thursday, October 10, 13