I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!
\
This is an example of how to use the Google Drive file picker and Google Drive API to retrieve files from Google Drive using pure JavaScript. At the time of writing (14th July 2013), Google have good examples for using these two APIs separately, but no documentation on using them together.
Note that this is just sample code, designed to be concise to demonstrate the API. In a production environment, you should include more error handling.
See a demo at http://stuff.dan.cx/js/filepicker/google/
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
<!DOCTYPE HTML> | |
<meta charset="utf8"> | |
<script src="leap.min.js"></script> | |
<style> | |
#box { | |
width: 200px; | |
height: 200px; | |
background-color: steelblue; | |
} | |
</style> |
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
/* | |
Sometimes, unicode symbols that have to be inserted in an HTML page should be escaped. | |
For example, everybody know, that’s “&” should be escaped as “&”, ” ” as “ ” and so on. | |
But what, if you should insert symbol, that you never used before. So you don’t know how it should be present or escaped. | |
Code below, helps you to get valid decimal unicode for appropriate symbol. | |
*/ | |
function getCharAsDecimalUTF8(char){ | |
var getUTF8 = escape(char); | |
console.log("&#" + parseInt(getUTF8.substring(getUTF8.match(/\%u/) !== null ? 2 : 1), 16) + ";"); | |
} |