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
// https://stackoverflow.com/a/63964522 | |
// requires Gmail API | |
const getLabelMap = () => { | |
const allLabels = Gmail.Users.Labels.list('me') | |
const labelMap = allLabels.labels.reduce((acc, label) => { | |
acc[label.name] = label.id | |
return acc | |
}, {}) | |
return labelMap | |
} |
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
! hybrid plain text gmail messages | |
! block images | |
||gm1.ggpht.com/$image,domain=mail.google.com,important | |
mail.google.com##img.CToWUd | |
!mail.google.com##.editable img | |
! remove blockquote nesting | |
mail.google.com##[data-message-id^="#msg"] blockquote:style(padding:0!important;margin: 0!important;border: none!important;) | |
!mail.google.com##.editable blockquote:style(padding:0!important;margin: 0!important;border: none!important;) |
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
// Based on and inspired by https://github.com/CesiumGS/webglreport | |
// https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Constants | |
const WebGLConstants = [ | |
'ALIASED_LINE_WIDTH_RANGE', | |
'ALIASED_POINT_SIZE_RANGE', | |
'ALPHA_BITS', | |
'BLUE_BITS', | |
'DEPTH_BITS', | |
'GREEN_BITS', |
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 locale(x) { return Utilities.formatDate(new Date(x), 'PST', 'EEE MMM d, yyyy') } | |
function constants() { | |
return { | |
spreadsheetId: '1RTKJTvzfst_ZVQHUyEy2PnB4P075verlDJLKMgb0UFU', | |
sheetId: 16057777, | |
startRow: 2, | |
startCol: { letter: 'A', num: 1 }, | |
endCol: { letter: 'E', num: 5 } | |
} |
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 getFolderId() { return '[Your Drive Folder Id]' /*Keys/Directory Review*/ } | |
function flatten(arr) { return [].concat.apply([], arr) } | |
function diffs(str1, str2, color) { | |
let diffs = [], arr1 = str1.replace(/\n/, '').split('\t').join(' ').split(' ') | |
const arr2 = str2.replace(/\n/, '').split('\t').join(' ').split(' ') | |
arr1.forEach((val, i) => val != arr2[i] && diffs.push(val)) | |
diffs.forEach(val => arr1[arr1.indexOf(val)] = `<span style="background:${color}">${val}</span>`) | |
return arr1.join(' ')+'\n' |
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 logToTextFile(filename, content) { | |
var files = DriveApp.getFilesByName(filename) | |
if (files.hasNext()) { return files.next().setContent(content) } | |
else { return DriveApp.createFile(filename, content) } | |
} | |
function getUnread() { | |
function flatten(arr) { return [].concat.apply([], arr) } | |
function formatDate(d) { return Utilities.formatDate(new Date(d), "PST", "EEE, MMM d @h:mm a")} | |
function removeDomain(strongWithEmail) { return strongWithEmail.replace(/<.+@.+>/gm, '')} |
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 onEdit(e){ | |
var sheetName = 'Daily Log' | |
var activeSheet = e.source.getActiveSheet() | |
if (activeSheet.getName() == sheetName) { | |
var seconds = 1000 | |
var row1 = 2 | |
var signCol = 4 | |
var whenSigned = SpreadsheetApp.newFilterCriteria().setHiddenValues(['TRUE']).build() |
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
const callIfFunction = x => x instanceof Function ? x() : x | |
const choose = switchFn => // cache cases | |
caseVal => callIfFunction(switchFn(caseVal)[caseVal] || switchFn().default) // get case | |
const agree = (x, ...list) => // agree on a fall through set | |
list.find(val => x === val) || list[0] | |
// make as many of these as needed | |
const colors = choice => ({ |
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
//Immutable state: | |
const state = Object.freeze({ }) | |
//Pure functions: | |
const fn = (val, dependencies = [ ]) => val+1 | |
//Higher-order functions: | |
const decorate = (x, fn) => { | |
return fn(x) | |
} |
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
//--------------Variables------------- | |
- | |
first = '', | |
last = '', | |
position = '', | |
office = '', | |
phone = '', | |
websiteURL = '', | |
invite = '', | |
degrees = [ |
NewerOlder