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
function doPost(e) { | |
try { | |
var sprops = backoff(function(){ | |
return PropertiesService.getScriptProperties().getProperties(); | |
}); | |
var base = FirebaseApp.getDatabaseByUrl(sprops.firebaseUrl, sprops.firebaseSecret); | |
var glog = new cLog("IpnPaypal", sprops.RECEIVER_EMAIL); // just for logging errors | |
var isProduction = sprops.Production == "true"; |
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> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>ACE Editor: submit, beautify and minify</title> | |
<style type="text/css" media="screen"> | |
#ace_js, #ace_css { | |
width: 95%; | |
height: 15em; | |
border: 1px solid silver; |
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
/** | |
* Pretends to take a long time to return two rows of data | |
* | |
* @param {string} endpoint | |
* @return {ResponseObject} | |
*/ | |
function doSomething (endpoint) { | |
Utilities.sleep(5 * 1000); // sleep for 5 seconds | |
return { | |
numberOfRows: 2, |
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
function onInstall(e) { | |
onOpen(e); | |
} | |
function onOpen(e) { | |
DocumentApp.getUi().createAddonMenu() | |
.addItem('Add Rules', 'showSidebar') | |
.addToUi(); | |
currentSet("Default"); |
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
/** | |
* Example use of a single pair of toast messages | |
*/ | |
function doSomethingExample() { | |
//toast(msg, title, timeoutSeconds) | |
SpreadsheetApp.getActive().toast("Working...", "Doing x", 30);//message 1 longer than you need | |
Utilities.sleep(8000); //8 seconds simulating work | |
SpreadsheetApp.getActive().toast("Finished!","OK", 2);//message 2 interrupts message 1 |
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
function exportSpreadsheet() { | |
//All requests must include id in the path and a format parameter | |
//https://docs.google.com/spreadsheets/d/{SpreadsheetId}/export | |
//FORMATS WITH NO ADDITIONAL OPTIONS | |
//format=xlsx //excel | |
//format=ods //Open Document Spreadsheet | |
//format=zip //html zipped | |
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
// Change this values based on your spreadsheet. | |
var SHEET_NAME = 'Form Responses 1'; | |
var STATUS_COLUMN_NUMBER = 4; | |
var PROCESSED_STATUS = 'Processed'; | |
var LAST_ROW_KEY = 'lastRow'; | |
var LOCK_TIMEOUT_MS = 60000; // 1 minute | |
var MAX_RUNTIME_MS = 240000; // 4 minutes | |
/** |
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
/** | |
* Sends an email using the contents of a Google Document as the body. | |
*/ | |
function sendDocument(documentId, recipient, subject) { | |
var html = convertToHtml(documentId); | |
html = inlineCss(html); | |
GmailApp.sendEmail(recipient, subject, null, { | |
htmlBody: html | |
}); | |
} |