Skip to content

Instantly share code, notes, and snippets.

View rheajt's full-sized avatar
🏠
Working from home

jordan rhea rheajt

🏠
Working from home
View GitHub Profile
@rheajt
rheajt / index.pug
Created October 20, 2017 08:02
'Stranger Things' - the alphabet wall
// 'Stranger Things' alphabet wall -
// Type or click to make the bulbs light up
-var letters = {"row1":['a','b','c','d','e','f','g','h'],"row2":['i','j','k','l','m','n','o','p','q'],"row3":['r','s','t','u','v','w','x','y','z']}
main.lights
each row, i in letters
ul.row(class=i)
each letter in row
li.item(id='item--' + letter)
span.bulb
span.letter= letter
1Dfp01ngInSXArtAxyPJibt0erlyBAgJJL_5y8eiKcGw
@rheajt
rheajt / callHeadersByName.gs
Created August 28, 2017 00:11
call columns by their headers
function callColumnsByHeaders() {
var ss=SpreadsheetApp.getActive();
var sh=ss.getActiveSheet();
var rg=sh.getDataRange();
var vA=rg.getValues();
var hA=vA[0]; //header row
for(var i=1;i<vA.length;i++)
{
var row=[];
@rheajt
rheajt / Code.gs
Created August 1, 2017 08:16
examples of simple triggers with google apps script
/**
* These simple triggers are available in Sheets, Docs, and Forms
* Most of this information can be found:
* https://developers.google.com/apps-script/guides/triggers/events
*/
function onOpen(e) {
// {
// authMode: 'LIMITED',
// source: 'Spreadsheet' || 'Document' || 'Form',
// user: 'User'
@rheajt
rheajt / RosterMaker.gs
Created June 20, 2017 14:33
google apps script to create multiple sections programmatically from a spreadsheet
function rosterMaker() {
//spreadsheet id of the rosters
var SHEET_ID = FormApp.getActiveForm().getDestinationId();
var ss = SpreadsheetApp.openById(SHEET_ID);
var form = FormApp.getActiveForm();
//get only the sheets with 'Roster' in the title
var sheets = ss.getSheets()
.filter(function(sheet) {return sheet.getName().match(/Roster/gi);});
@rheajt
rheajt / Code.gs
Last active April 11, 2018 19:00
google apps script code to combine the calendarapp with an onsubmit trigger in a google form
function cartSignup(event) {
//this should be the calendar id you get from the settings page
var CALENDAR_ID = '<<YOUR CALENDAR ID>>';
var responses = event.response.getItemResponses();
var cartResponses = [];
//loop through the item responses and push them into the empty array
@rheajt
rheajt / Code.gs
Created June 14, 2017 15:38
google apps script to open a new website in a new window
function openTab() {
var selection = SpreadsheetApp.getActiveSheet().getActiveCell().getValue();
var html = "<script>window.open('" + selection + "');google.script.host.close();</script>";
var userInterface = HtmlService.createHtmlOutput(html);
SpreadsheetApp.getUi().showModalDialog(userInterface, 'Open Tab');
}
@rheajt
rheajt / Code.gs
Created June 13, 2017 16:32
google apps script code to randomize a list in a document
function onOpen() {
DocumentApp.getUi()
.createMenu('Multiple-Choice-Randomizer')
.addItem('Run', 'randomizer')
.addToUi();
}
function randomizer() {
var doc = DocumentApp.getActiveDocument();
@rheajt
rheajt / Code.gs
Created June 13, 2017 16:30
google apps script code to append an image to a document with the file id
function onOpen() {
DocumentApp.getUi()
.createMenu('ID-TO-IMAGE')
.addItem('Run', 'runIdToImage')
.addToUi();
}
function runIdToImage() {
var doc = DocumentApp.getActiveDocument();
@rheajt
rheajt / Code.gs
Last active January 6, 2021 21:36
create data validation cells with either named ranges or columns from a sheet in Google Sheets
function onOpen() {
SpreadsheetApp.getUi()
.createMenu('MULTI DATA VALIDATION')
.addItem('Open', 'openSidebar')
.addToUi();
}
function onInstall() {
installEditTrigger();
onOpen();