Skip to content

Instantly share code, notes, and snippets.

View justinsbarrett's full-sized avatar

justinsbarrett

View GitHub Profile
@justinsbarrett
justinsbarrett / reverseAttachmentOrder.js
Last active May 25, 2022 13:23
Reverses the order of items in an Airtable attachment field.
/**
* Title: Reverse attachment order
* Version: 1.0
* License: MIT
* Author: Justin Barrett
* Sites:
* http://allaboutthatbase.tips
* https://www.youtube.com/c/AllAboutThatBase1
*
* Github Gist: https://gist.github.com/justinsbarrett/dcab601ccbc6834854773e67e891b4e7
@justinsbarrett
justinsbarrett / markMatchingRecords.js
Created November 16, 2021 19:03
Mark matching records between two tables in Airtable.
const settings = input.config({
title: "Mark Matching Records",
description: `Searches an incoming data table for records matching those in a \"master\" table.
Any matching records are marked via a checkbox field.`,
items: [
input.config.table("masterTable", {
label: "Master table",
description: "The table containing the master list."
}),
input.config.field("masterField", {
@justinsbarrett
justinsbarrett / recursiveHierarchyLabels.js
Last active March 3, 2024 04:31
Creates a series of labels based on a hierarchy of records in a single table, with the hierarchy determined by linking records.
/**
* Title: Recursive Hierarchy Labels
* License: MIT
* Author: Justin Barrett
* Sites:
* http://www.allaboutthatbase.tips - Main website
* https://www.youtube.com/c/AllAboutThatBase1 - All About That Base (YouTube channel)
* Show your support: https://ko-fi.com/allaboutthatbase
*
* Revision history:
@justinsbarrett
justinsbarrett / setSequentialEventTimes-scriptApp.js
Last active January 25, 2022 07:51
An Airtable script that will organize sequential events, where one starts when the previous one ends. See the Airtable community forum thread for screenshots and other notes: https://community.airtable.com/t/set-sequential-event-times/43722
// Allow user to select the table and view to use, and which fields will be affected
const config = input.config({
title: "Set Sequential Event Times",
description: `Update a collection of events that occur in sequence so that each new event starts when the previous event ends.
* Use the fixed start marker field (a checkbox field) to mark all records that have fixed start times.
* The first record in the selected view **must** have a fixed start time.
* Any record without a fixed start time will have its start time calculated based on the end time of the previous record.`,
items: [
input.config.table("eventsTable", {
@justinsbarrett
justinsbarrett / delayTimer.js
Created September 18, 2021 23:52
Delay timer
/**
* Delay execution a specified number of seconds.
* @param {number} seconds
*/
function delay(seconds) {
const startTime = Date.now()
while (Date.now() - startTime < seconds * 1000)
continue
}
@justinsbarrett
justinsbarrett / countdownTimer.js
Created September 18, 2021 23:37
A simple, configurable countdown timer for Airtable.
// Setup
const timerOptions = ["30", "45", "60"]
// Functions
function showTime(seconds) {
const min = Math.floor(seconds / 60)
const sec = seconds % 60
output.clear()
output.markdown(`# ${min}:${("0" + sec).slice(-2)}`)
}
@justinsbarrett
justinsbarrett / reconnectMayaAnimCurves.py
Created June 16, 2021 20:49
This attempts to reconnect any disconnected animCurve nodes found in a Maya scene. Written for Python 2.x. Adjust as needed for v3+
import maya.cmds as mc
def findNodeAndAttribute(animCurve):
parts = animCurve.split("_")
for index in range(len(parts)):
node = "_".join(parts[:index + 1])
attribute = "_".join(parts[index + 1:])
# Look for the node
# If it exists, look for the attribute
if mc.objExists(node):
/**
* Title: Record Timer (Automation)
* Version: 1.0
* License: MIT
* Author: Justin S Barrett
* Sites:
* http://www.justinsbarrett.com - Main website
* https://www.youtube.com/channel/UCElPqW_1xVXToQPB3Y_WD3Q - All About That Base
*
* Description: An alternative to Airtable's built-in timer block. With this script,
@justinsbarrett
justinsbarrett / recordTimer.js
Created August 11, 2020 23:41
Record timer script for Airtable
/**
* Title: Record Timer
* Version: 1.0
* License: MIT
* Author: Justin Barrett
* Sites:
* http://www.justinsbarrett.com - Main website
* https://www.youtube.com/channel/UCElPqW_1xVXToQPB3Y_WD3Q - All About That Base (YouTube channel)
*
* Description: An alternative to Airtable's built-in timer block. With this script,
@justinsbarrett
justinsbarrett / processDonations.js
Last active December 5, 2021 03:07
Donation processing script
const detailedOutput = false;
// Get tables
let proctable = base.getTable("Donation Processing");
let reqtable = base.getTable("Donation Requests");
let orgtable = base.getTable("Organizations");
let contactstable = base.getTable("Contacts");
// Get records from processing table
let procrecords = await proctable.selectRecordsAsync();