One Paragraph of project description goes here
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
| function isbnLookup(id) { | |
| var url = "https://www.googleapis.com/books/v1/volumes?country=US&q=isbn:"+id; | |
| var options = {contentType : "application/json"}; | |
| var resp = UrlFetchApp.fetch(url, options); | |
| if (resp == null || resp == "") return "N/A"; | |
| var respdata = JSON.parse(resp.getContentText()); | |
| if (respdata["items"].length == 0) return "Not found"; | |
| return respdata["items"][0]["volumeInfo"]["title"]; | |
| } |
| /* | |
| Sources: | |
| - MDN: https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement | |
| - WHATWG: https://html.spec.whatwg.org/multipage/embedded-content.html#media-element | |
| */ | |
| // METHODS | |
| video.load(); // Reload video; No args | |
| video.play(); // Play video; No args | |
| video.pause(); // Pause video; No args |
| // Promise.all is good for executing many promises at once | |
| Promise.all([ | |
| promise1, | |
| promise2 | |
| ]); | |
| // Promise.resolve is good for wrapping synchronous code | |
| Promise.resolve().then(function () { | |
| if (somethingIsNotRight()) { | |
| throw new Error("I will be rejected asynchronously!"); |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000| var parser = document.createElement('a'); | |
| parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
| parser.protocol; // => "http:" | |
| parser.hostname; // => "example.com" | |
| parser.port; // => "3000" | |
| parser.pathname; // => "/pathname/" | |
| parser.search; // => "?search=test" | |
| parser.hash; // => "#hash" | |
| parser.host; // => "example.com:3000" |