Skip to content

Instantly share code, notes, and snippets.


Spencer Easton Spencer-Easton

View GitHub Profile
View C++ inheritance
#include "vertex.h"
#include "graph.h"
#include "set.h"
using namespace std;
class base
Spencer-Easton /
Created Dec 16, 2016
A stupid simple Iterator Service
var IteratorService_ = function(array){
var newArray = array.slice(0);
Object.defineProperty(newArray, 'nextIndex', { value: 0, enumerable: false, writable:true });
Object.defineProperty(newArray, 'next', { value: function(){if(this.nextIndex >= this.length){throw new Error("NoSuchElementException")}else{return this[this.nextIndex++]}}, enumerable: false });
Object.defineProperty(newArray, 'hasNext', { value: function(){return (this.nextIndex < this.length)}, enumerable: false });
return newArray;
View Email Notifications from Date in Spreadsheet
function emailReminder() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var leases = ss.getSheetByName("Leases").getDataRange().getValues();
var emails = ss.getSheetByName("Emails").getDataRange().getValues();
var notificationWindows = {}
notificationWindows[addMonths(new Date(),6)] = makeNotifications(emails, "Six Months");
notificationWindows[addMonths(new Date(),3)] = makeNotifications(emails, "Three Months");
notificationWindows[addMonths(new Date(),1)] = makeNotifications(emails, "One Month");
View Example GAE static hosting app.yaml
application: YOURPROJECTID
version: 1
runtime: python27
api_version: 1
threadsafe: yes
- url: /(.+)
static_files: public/\1
upload: public/(.*)
Spencer-Easton / gist:0d203b757783e0d35087
Last active Aug 13, 2016
firebase.json hosting example
View gist:0d203b757783e0d35087
"hosting": {
"public": “.”,
Spencer-Easton /
Last active Oct 16, 2021
Example on how to export a Google sheet to various formats, includes most PDF options
function exportSpreadsheet() {
//All requests must include id in the path and a format parameter
//format=xlsx //excel
//format=ods //Open Document Spreadsheet
//format=zip //html zipped
Spencer-Easton / Duel Auth Example
Last active Aug 29, 2015
Duel Auth for a script
View Duel Auth Example
var localAuth = false;
var sProps = PropertiesService.getScriptProperties();
function doGet() {
var driveService = getDriveService();
if (!driveService.hasAccess()) {
return showAuth();
Spencer-Easton / XMLtoJSON
Created Apr 8, 2015
Script to convert XML to JSON using XmlService - Originaly published in a +Google Apps Script community thread by Eric Koleda
* Converts an XML string to a JSON object, using logic similar to the
* sunset method Xml.parse().
* @param {string} xml The XML to parse.
* @returns {Object} The parsed XML.
function xmlToJson(xml) {
var doc = XmlService.parse(xml);
var result = {};
var root = doc.getRootElement();