Skip to content

Instantly share code, notes, and snippets.

Peter Herrmann peterherrmann

Block or report user

Report or block peterherrmann

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tmcoma
tmcoma / login.html
Last active Aug 29, 2015 — forked from entaq/Google_oAuth.js
OAuth2 end-to-end example for client auth using newStateToken
View login.html
FAQ
Why open a new window for the authorization?
Because if you load the contents of the auth page directly IN a sidebar (or script) using HtmlService, its buttons won't work because they've been cajoled.
Why not just the the access token provided by GAS Libraries?
Because lord only knows what that thing is scoped for.
How do I clear my token?
Pass ?reset parameter to the url, or call clearMyAuthToken() directly.
@soundTricker
soundTricker / datastore.js
Created May 17, 2013
Google Apps ScriptからCloud Datastore APIへのクエリ
View datastore.js
function myFunction() {
var option = googleOAuth_();
option.method = "post";
option.contentType = 'application/json';
option.payload = JSON.stringify({
"query":
{
"kinds":
[
@jsdbroughton
jsdbroughton / GoogleSheetPDF.js
Last active Aug 2, 2017
Function to convert a given Google Spreadsheet [Sheet] into a PDF.
View GoogleSheetPDF.js
/**
* Function to convert a given Google Spreadsheet [Sheet] into a PDF.
*
* @param {string} key This is the Id of the Sheet to be converted bothe the DocsList.getId() and the SpreadsheetApp.getId() versions work
* @param {string} name [Optional] Intended Filename. If omitted, uses the Sheet filename.
* @param {object} options Settings object for the crafting of the PDF. Defaults to A4, no gridline print etc. <pre>
* {
* format:Enum,
* size:Enum,
* headers: Bool,
@peterherrmann
peterherrmann / gist:2700284
Created May 15, 2012
GASRetry - Exponential backoff JavaScript implementation for Google Apps Script (Library project key: "MGJu3PS2ZYnANtJ9kyn2vnlLDhaBgl_dE")
View gist:2700284
/**
* Invokes a function, performing up to 5 retries with exponential backoff.
* Retries with delays of approximately 1, 2, 4, 8 then 16 seconds for a total of
* about 32 seconds before it gives up and rethrows the last error.
* See: https://developers.google.com/google-apps/documents-list/#implementing_exponential_backoff
* <br>Author: peter.herrmann@gmail.com (Peter Herrmann)
<h3>Examples:</h3>
<pre>//Calls an anonymous function that concatenates a greeting with the current Apps user's email
var example1 = GASRetry.call(function(){return "Hello, " + Session.getActiveUser().getEmail();});
</pre><pre>//Calls an existing function
You can’t perform that action at this time.