Skip to content

Instantly share code, notes, and snippets.

View davecra's full-sized avatar
💭
Coding for arrays

David E. Craig davecra

💭
Coding for arrays
View GitHub Profile
@davecra
davecra / ArchivedEntityCanNotBeUpdated.json
Created October 22, 2024 14:33
ArchivedEntityCanNotBeUpdated Error updating Premieum Plan from Power Automate
{
"error": {
"code": "ArchivedEntityCanNotBeUpdated",
"message": "Archived entity can't be modified.",
"innerError": {
"date": "2024-10-22T13:33:52",
"request-id": "f6cbf471-eead-49e8-944c-c3d9f9b00147",
"client-request-id": "f6cbf471-eead-49e8-944c-c3d9f9b00147"
}
}
@davecra
davecra / safari_issue_fix.js
Last active July 12, 2024 05:15
Safari Issue Fix
class thing {
render = () => {
const html = /*html*/`<button id="btn1">Test</button>`;
document.body.innerHTML = html;
const msg = "something here";
document.getElementById("btn1").addEventListener("click", () => {
this.#getData(msg);
});
}
#getData = (msg) => {
@davecra
davecra / safari_issue.js
Created July 12, 2024 04:42
Safari Issue
window.setTimeout(async() => {
const o = new thing();
await o.render();
}, 1);
class thing {
render = async () => {
const html = /*html*/`<button id="btn1">Test</button>`;
document.body.innerHTML = html;
const msg = "something here";
@davecra
davecra / getLatsetResponse.js
Created July 6, 2024 04:25
Demonstrates how to use OutlookEmailBodyParser
const emailBody = new Promise((resolve, reject) => {
try {
Office.context.mailbox.item.body.getAsync(type, (result) => {
if (result.status === Office.AsyncResultStatus.Succeeded) {
resolve(result.value);
} else {
reject(result.error);
}
});
} catch {
@davecra
davecra / outlookEmailBodyParser.js
Created July 6, 2024 04:14
Outlook Email Body Parser
export default class OutlookEmailBodyParser {
/** @type {String} */
#body = null;
/**
* Creates an instance of the Outlook Email Body Parser
* Next you call:
* - getLatestResponse() to get the most recent message
* @param {String} body
*/
constructor(body) {
@davecra
davecra / etag.js
Created November 10, 2023 03:13
Converts an @odata.etag
const updatedTag = eTag.replace('W/"', '"').replace('\\"', "");
@davecra
davecra / ref.js
Created November 10, 2023 03:11
Creates a new reference for a Planner Task Attachment
const ref = {
/** @type {PlannerReference} */
[this.#encodePlannerExternalReferenceUrl(driveItem.webUrl)]: {
"@odata.type": "#microsoft.graph.plannerExternalReference",
alias: name,
type: "Other",
},
};
@davecra
davecra / enocdePlannerUrl.js
Created November 10, 2023 03:04
Encodes a URL in a format the Graph API References will accept
/**
* Encodes the URL ins the special planner format that is for oif but not quite
* following the encodeURIComponent() specification...
* @param {String} url
* @returns {String}
*/
#encodePlannerExternalReferenceUrl = (url) => {
// Encode specific characters: : . _
const encodedUrl = url.replace(/:/g, "%3A").replace(/\./g, "%2E").replace(/ /g, "%20");
return encodedUrl;
@davecra
davecra / client.js
Created October 22, 2023 20:20
Procured Board Button
/// <reference path="trello.d.js" />
/** @type {TrelloPowerUp} */
const tpu = window.TrelloPowerUp;
tpu.initialize({
'board-buttons':
/**
* Returns the board button
* @param {TrelloObject} t
* @returns {TrelloBoardButtonOption[]}
*/
@davecra
davecra / webpack.config.js
Created October 22, 2023 20:04
Webpack.config.js for Power-Up
const CopyWebpackPlugin = require("copy-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const fs = require("fs");
module.exports = async (env, options) => {
const isProduction = options.mode === 'production';
const config = {
devtool: isProduction ? false : 'source-map',
mode: isProduction ? "production" : "development",
entry: {
details: "./js/details.js",