Skip to content

Instantly share code, notes, and snippets.

View markdon's full-sized avatar

Mark Donnellon markdon

View GitHub Profile
(function deleteFiles(){
const communityId = /communityUuid=([a-f0-9-]+)/.exec(window.location.href)[1];
fetch(`https://devconn6.internal.isw.net.au/files/form/api/communitylibrary/${communityId}/feed?ps=500`).then((response)=>{
response.text().then((text)=>{
const parser = new DOMParser();
const xml = parser.parseFromString(text, 'application/xml');
const ids = [];
for(let el of xml.querySelectorAll('entry uuid'))
ids.push(el.textContent);
@markdon
markdon / boardsCreateCards.js
Last active July 1, 2019 01:14
Boards WebSphere Create Lots of Cards
// THESE ARE TWO DIFFERENT FUNCTIONS
// Add cards to every list
(function(){
const cardsPerList = 200;
Boards.current.boardNode.attributes.childNodes.models.forEach(list=>{
for(let i = 0; i <= cardsPerList; i++ )
list.createTaskChild(`Card ${i}`);
});
})()
@markdon
markdon / downloadBoardData.js
Created February 6, 2019 23:40
Download the currently open board as a .json file
fetch(`./node/${Boards.current.boardNode.id}`).then(response=>response.json()).then(boardData=> {
const element = document.createElement('a');
element.setAttribute('href', 'data:application/json;charset=utf-8,' + encodeURIComponent(JSON.stringify(boardData)));
element.setAttribute('download', boardData.name);
element.style.display = 'none';
document.body.appendChild(element);
element.click();
document.body.removeChild(element);
});
@markdon
markdon / boardsCreateComment.js
Created February 7, 2019 22:06
Create a comment with Boards API
fetch(`./node`, {
method: "POST",
headers:{"Content-Type":"application/json"},
body:`{
"boardId" : "${Boards.current.boardNode.id}",
"priv" : 0,
"parentId" : "${Boards.current.node.id}",
"position" : 1000000,
"template" : 0,
"commonType" : "reply",
@markdon
markdon / boards-date-shifter.js
Last active February 13, 2019 00:35
[Boards Date Shifter]
/*
This script will find an origin node (which must already have a due date),
find the difference between the current origin dueDate and NEW_ORIGIN_DATE,
then adjust all due dates in the board by the difference in dates.
In other words...
It shifts all due dates forwards or backwards based on
how much we change the date on the origin card.
@markdon
markdon / 9000.ps1
Last active February 19, 2019 03:42
Powershell Copy 9000
$NumArray = (1..9000)
ForEach
($number in $numArray) {
Copy-Item "C:\Users\mdonnellon\Pictures\9000\itsover9000.jpg" -Destination "C:\Users\mdonnellon\Pictures\9000\itsover9000_$number.jpg"
}
@markdon
markdon / board-stats.js
Last active June 27, 2019 01:41
[Board Stats for Boards Websphere] This script will output the counts of each type of node in the currently open board. Internet Explorer does not support this code.
(()=>{
const counts = {};
Boards.current.boardNode.getAllDescendants().forEach((node)=>{
const type = node.attributes.commonType;
if(!counts[type]) counts[type] = 1;
else counts[type]++;
});
Object.keys(counts).forEach(key => console.log(`${key} ${counts[key]}`));
return counts;
})();
@markdon
markdon / find-comments.js
Last active June 28, 2019 00:04
[Boards Comment Finder] This script will count the comments on each card individually and open the card with the most comments
(()=>{
const boardNode = Boards.current.boardNode;
const results = {
[boardNode.id]:{
id:boardNode.id, replies:0, hashURL:boardNode.getHashURL()
}
};
const nodes = Boards.current.boardNode.getAllDescendants();
// initialize results
nodes.forEach( node => results[node.id] = {id: node.id, replies:0, url:node.getAbsoluteURL()});
@markdon
markdon / ibm-cnx-register-oauth-app.py
Last active July 4, 2019 00:44
[CNX Register OAuth App] a wsadmin jython script that will register a new oauth application. It may be pasted straight into wsadmin terminal after customising.
import base64
# https://www.ibm.com/support/knowledgecenter/en/SSYGQH_6.0.0/admin/admin/r_admin_common_oauth_manage_list.html
# Remove an incorrectly registered app with OAuthApplicationRegistrationService.deleteApplication(String appId)
# these four properties should be customised according to your setup
cnxDomain = 'connections.example.com'
boardsDomain = 'kudosboards.com'
appId = 'kudosboards'
appName = 'Kudos Boards'
@markdon
markdon / appium.log
Created January 9, 2020 03:52
HelloCordova appium switchContext hang
2020-01-09 03:33:13:744 - [HTTP] --> POST /wd/hub/session
2020-01-09 03:33:13:744 - [HTTP] {"capabilities":{"alwaysMatch":{"platformName":"iOS","platformVersion":"13.3","app":"/var/tmp/Debug-iphonesimulator/HelloCordova.app","deviceName":"iPhone 11","newCommandTimeout":360000},"firstMatch":[{}]},"desiredCapabilities":{"platformName":"iOS","platformVersion":"13.3","app":"/var/tmp/Debug-iphonesimulator/HelloCordova.app","deviceName":"iPhone 11","newCommandTimeout":360000}}
2020-01-09 03:33:13:746 - [debug] [W3C] Calling AppiumDriver.createSession() with args: [{"platformName":"iOS","platformVersion":"13.3","app":"/var/tmp/Debug-iphonesimulator/HelloCordova.app","deviceName":"iPhone 11","newCommandTimeout":360000},null,{"alwaysMatch":{"platformName":"iOS","platformVersion":"13.3","app":"/var/tmp/Debug-iphonesimulator/HelloCordova.app","deviceName":"iPhone 11","newCommandTimeout":360000},"firstMatch":[{}]}]
2020-01-09 03:33:13:746 - [debug] [3