Skip to content

Instantly share code, notes, and snippets.

Spencer Easton Spencer-Easton

Block or report user

Report or block Spencer-Easton

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
View C++ inheritance
#include "vertex.h"
#include "graph.h"
#include "set.h"
using namespace std;
class base
{
public:
@Spencer-Easton
Spencer-Easton / InteratorService.gs
Created Dec 16, 2016
A stupid simple Iterator Service
View InteratorService.gs
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
handlers:
- url: /(.+)
static_files: public/\1
upload: public/(.*)
@Spencer-Easton
Spencer-Easton / gist:0d203b757783e0d35087
Last active Aug 13, 2016
firebase.json hosting example
View gist:0d203b757783e0d35087
{
"hosting": {
"public": “.”,
"headers":[{
"source":"**",
"headers":[{
"key":"Access-Control-Allow-Origin",
"value":"*"
}]
}]
@Spencer-Easton
Spencer-Easton / exportSpreadsheet.gs
Last active Nov 14, 2019
Example on how to export a Google sheet to various formats, includes most PDF options
View exportSpreadsheet.gs
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
@Spencer-Easton
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
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
View XMLtoJSON
/**
* 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();
You can’t perform that action at this time.