Skip to content

Instantly share code, notes, and snippets.

@tdalon
tdalon / Jira_Expand&Rename.pq
Last active April 24, 2024 07:04
Jira to PowerBI
// STEP Expand&Rename
let
IssuesTable = GetIssuesTable,
ExpIssues = Table.ExpandRecordColumn(IssuesTable, "Column1", {"key", "fields"}, {"Key", "Fields"}),
// expand fields s. https://exceed.hr/blog/dynamically-expand-table-or-record-columns-in-power-query/
IssuesRaw = Table.ExpandRecordColumn(ExpIssues, "Fields", Record.FieldNames(ExpIssues{0}[Fields]),Record.FieldNames(ExpIssues{0}[Fields]) ),
// extracting field info
restUrl = JiraRootUrl&"/rest/api/2/field",
FieldsList= Json.Document(Web.Contents(restUrl)),
@tdalon
tdalon / FocusAssist.ahk
Last active April 18, 2024 00:05
AHK Script to set Focus Assist mode with an Hotkey or by script
FocusAssist(sInput){
Run, ms-settings:quiethours
; Wait for WinTitle=Settings
WinWaitActive,Settings
UIA := UIA_Interface()
WinId := WinActive("A")
UIAEl := UIA.ElementFromHandle(WinId)
@tdalon
tdalon / Confluence_GetVerLink.ahk
Created February 26, 2024 10:38
Confluence: Get Version Information
@tdalon
tdalon / AddNumbers.js
Created February 7, 2024 10:31
Confluence Bookmarklets for Numbered Headings
function addIndex() {
var indices = [];
jQuery(".ak-editor-content-area .ProseMirror").find("h1,h2,h3,h4,h5,h6").each(function(i,e) {
var hIndex = parseInt(this.nodeName.substring(1)) - 1;
if (indices.length - 1 > hIndex) {
indices= indices.slice(0, hIndex + 1 );
}
if (indices[hIndex] == undefined) {
indices[hIndex] = 0;
@tdalon
tdalon / PasteImageLink.ahk
Last active February 7, 2024 09:07
Paste web image link in Confluence Cloud Fabric Editor
@tdalon
tdalon / JiraFieldName2Id.pq
Last active December 24, 2023 18:45
How to Get Jira Issue Field Value in PowerQuery M
(FieldName as text) as text =>
let
Source = Json.Document(Web.Contents(JiraRootUrl & "/rest/api/latest/field")),
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"ExpandedTable" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"id", "name"}, {"id", "name"}),
Record = Table.First(Table.SelectRows(ExpandedTable, each ([name] = FieldName))),
FieldId = Record.Field(Record,"id")
in
FieldId
@tdalon
tdalon / JiraEpics.pq
Created August 8, 2023 10:08
Import Jira Epics with PowerQuery
let
JiraRootUrl = getNamedCellValue("JiraRootUrl"),
ProjectKey = getNamedCellValue("ProjectKey"),
Source = Json.Document(Web.Contents(JiraRootUrl & "/rest/api/2/search?jql=project=" & ProjectKey & " AND issuetype = Epic AND labels in ('process_improvement')")),
issues = Source[issues],
#"Converted to Table" = Table.FromList(issues, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", { "fields","key"}, { "Column1.fields","EpicKey"}),
#"Expanded Column1.fields" = Table.ExpandRecordColumn(#"Expanded Column1", "Column1.fields", {"customfield_10104"}, {"Epic Name"})
in
#"Expanded Column1.fields"
@tdalon
tdalon / Teams_GetMeetingWindow.ahk
Last active November 30, 2023 15:23
Get Microsoft Teams active Meeting Window with AutoHotkey
Teams_GetMeetingWindow(Minimize:=false,showTrayTip:=true){ ; @fun_teams_getmeetingwindow@
; Syntax:
; hWnd := Teams_GetMeetingWindow(Minimize:=true)
; If window is not found, hwnd is empty
; Input Arguments:
; Minimize: if true, minimized (aka Call in Progress) meeting window can be returned
;
; See implementation explanations here:
; https://tdalon.blogspot.com/2022/07/ahk-get-teams-meeting-win.html
; Does not require window to be activated
@tdalon
tdalon / Teams_Mute.ahk
Last active November 3, 2023 13:43
Teams Mute AutoHotkey
Teams_Mute(State := 2,showInfo:=true,restoreWin:=true){
; State:
; 0: mute off, unmute
; 1: mute on
; 2*: (Default): Toggle mute state
WinId := Teams_GetMeetingWindow()
If !WinId ; empty
return
@tdalon
tdalon / Teams_SwitchTenant.ahk
Created October 23, 2023 07:15
Teams New Switch Tenant
Teams_SwitchTenant(sTenant) {
WinId := Teams_GetMainWindow()
If !WinId ; empty
return
UIA := UIA_Interface()
TeamsEl := UIA.ElementFromHandle(WinId)
If !TeamsEl.FindFirstBy("AutomationId=idna-me-control-set-status-message-trigger") { ; menu not opened
; Click on avatar
MeCtrl := TeamsEl.FindFirstBy("AutomationId=idna-me-control-avatar-trigger")