Skip to content

Instantly share code, notes, and snippets.

@sranso
Last active August 29, 2015 14:10
Show Gist options
  • Save sranso/754c33a252bbdf26ee48 to your computer and use it in GitHub Desktop.
Save sranso/754c33a252bbdf26ee48 to your computer and use it in GitHub Desktop.

have a generic placeholder, something like "Securely fetching data 🔒 ..." and a spinner.

you can base 64 encode our spinner and include it right on the page so it gets sent with the initial payload.

you could put style tags in the body too so the styles only exist before onReady

###base64

  • really just a way of encoding information using only 64 symbols
  • usually a bunch of ascii

###bases in general

  • base2 is binary (0,1)
  • base10 encodes info with ten symbols (1,2,3,4,5,6,7,8,9,0)
  • base16 is hex, so it's like '1,2,3,4,5,6,7,8,9,0,a,b,c,d,e,f'
  • base64 uses more
  • the more symbols you have available to encode information the fewer number of symbols you need to encode more information
  • a way of representing values
  • you can use mime types to tell the browser what the thing is
    • ex 'application/json' or 'text/html' or specify an encoding like base64

###mime types

  • internet media type, standard identifier used to indicate type of data a file contains
  • commonly used in email clients, browsers, search engines
  • e.g. text/html; charset=UTF-8 where text is type, html is subtype, charset=UTF-8 is optional param indicating charcter encoding
  • complete list
  • application/javascript is preferred over text/javascript bc exact bytes of a file must be preserved exactly -- application is a binary text type, while text is technically character-based, and binary will be more reliable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment