Skip to content

Instantly share code, notes, and snippets.

@bsoist
Created March 10, 2021 22:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bsoist/9f4d90c7facea69a8ef3bdc25fb34eb7 to your computer and use it in GitHub Desktop.
Save bsoist/9f4d90c7facea69a8ef3bdc25fb34eb7 to your computer and use it in GitHub Desktop.
// edit the next line to use your calendars
calendars = ['home', 'work', 'evilplan'];
inputString = editor.getText();
stringParts = inputString.split('\n');
dateTimeDetails = stringParts[1];
cal = stringParts[2];
calendar = stringParts[2].slice(0,cal.length).toLowerCase();
newText = '';
calendars.forEach(function(c){
if (calendar === c) {
event = stringParts[0];
} else {
event = "busy";
}
newText += event + ' ' + dateTimeDetails;
newText += ' /' + c;
newText += '\n';
});
editor.setText(newText);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment