Skip to content

Instantly share code, notes, and snippets.

View stevedep's full-sized avatar

Steve de Peijper stevedep

View GitHub Profile
@stevedep
stevedep / dataRoles
Last active October 9, 2022 05:29
dataRoles
"dataRoles": [
{
"displayName": "KPI",
"name": "kpi",
"kind": "Grouping"
},
{
"displayName": "Description",
"name": "description",
"kind": "Grouping"
"dataViewMappings": [
{
"categorical": {
"categories": {
"select": [
{ "bind": {"to" : "kpi" }},
{ "bind": {"to" : "description" }},
{ "bind": {"to" : "tooltip" }}
]
},
@stevedep
stevedep / visual.ts
Created October 9, 2022 06:19
interface
interface kpiDataPoint {
index: number,
kpivalue: string,
selectionId: ISelectionId,
colour: string,
selector: any,
highlight: string
}
@stevedep
stevedep / visual.ts
Created October 9, 2022 06:21
for Loop
for (var i = 0; i < kpiVals.length; i++)
{
let selectionId: ISelectionId = this.host.createSelectionIdBuilder()
.withCategory(categorical.categories[kpiId], i)
.createSelectionId();
this.kpiDataPoints.push({
kpivalue : <string>kpiVals[i],
colour : (category.objects) ? category.objects[i] ? String(<Fill>(category.objects[i].colorSelector.fill['solid']['color'])) : "#FF0000" : "#FF0000", //objects is initially not present
highlight: (measurevals.highlights) ? (measurevals.highlights[i]) ? "Y" : "N" : "N",
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time
from datetime import datetime
Sub check_availability()
Dim myOlApp As New Outlook.Application
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set objApp = CreateObject("Outlook.Application")
'Set objItem = Outlook.Application.ActiveExplorer.Selection.Item(1)
Set objItem = objApp.ActiveInspector.CurrentItem
'Set objAttendees = Outlook.Application.ActiveExplorer.Selection.Item(1).Recipients
Set objAttendees = objItem.Recipients
Dim oCurrentUser As Recipient
Dim FreeBusy(20, 2) As String
let
Source = Json.Document(File.Contents("C:\Users\username\Downloads\eneco.json")),
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"data"}, {"data"}),
#"Expanded data" = Table.ExpandRecordColumn(#"Expanded Column1", "data", {"metadata", "usages"}, {"data.metadata", "data.usages"}),
#"Expanded data.metadata" = Table.ExpandRecordColumn(#"Expanded data", "data.metadata", {"interval", "aggregation"}, {"data.metadata.interval", "data.metadata.aggregation"}),
#"Expanded data.usages" = Table.ExpandListColumn(#"Expanded data.metadata", "data.usages"),
#"Expanded data.usages1" = Table.ExpandRecordColumn(#"Expanded data.usages", "data.usages", {"period", "entries", "summary"}, {"data.usages.period", "data.usages.entries", "data.usages.summary"}),
#"Expanded data.usages.period" = Table.ExpandRecordColumn(#"Expanded data.usages1", "data.usages.period
let
Source = Web.BrowserContents("https://www.autowereld.nl/info/mitsubishi/outlander/", [WaitFor = [Timeout = #duration(0,0,0,10)]]),
HtmlTable = Html.Table( Source, {{"Link", "a", each [Attributes][href]}}, [RowSelector=".item.model"]),
#"Replaced Value" = Table.ReplaceValue(HtmlTable,"/info/","https://www.autowereld.nl/info/",Replacer.ReplaceText,{"Link"}),
//Example = #"Replaced Value"[Link]{0},
fnGetDetails = (url) =>
let
OpenUrl = Web.BrowserContents(url),
HtmlTableDetails = Html.Table( OpenUrl, {{"Model", ".type"}, {"Price", ".price"}, {"Transmission", ".transmission"}, {"From", ".from"}, {"Until", ".until"}}, [RowSelector="a.item"])
(p) => let
Source = Web.BrowserContents(Url & "&page=" & p, [WaitFor = [Timeout = #duration(0,0,0,10)]]),
JsonDocument = Json.Document( Text.Split( Text.Split( Source, "<script id=""__NEXT_DATA__"" type=""application/json"">"){1}, "</script>"){0}),
props = JsonDocument[props],
pageProps = props[pageProps],
initialState = pageProps[initialState],
searchReducer = initialState[searchReducer],
occasions = searchReducer[occasions],
#"Converted to Table" = Table.FromList(occasions, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"id", "title", "model", "modelId", "brand", "brandId", "price", "img", "year", "bodyType", "fuel", "isImported", "provider", "licensePlate", "km", "description", "nameEntry", "place", "province", "endAuction", "dealerInfo", "popup", "portalListDescription", "portals", "schemaOrg"}, {"id", "title", "model", "modelId", "brand", "brandId", "price", "img", "year", "
let
Source = List.Generate(() => 1, each _ <= NumberOfPages, each _ + 1),
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Changed Type" = Table.TransformColumnTypes(#"Converted to Table",{{"Column1", type text}}),
#"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Column1", "Page"}}),
#"Added Custom" = Table.AddColumn(#"Renamed Columns", "Data", each fnCarData([Page])),
#"Removed Other Columns" = Table.SelectColumns(#"Added Custom",{"Data"}),
#"Expanded Data" = Table.ExpandTableColumn(#"Removed Other Columns", "Data", {"id", "title", "price", "year", "fuel", "provider", "licensePlate", "km", "description", "nameEntry", "place", "province", "endAuction", "ModelInfo", "CatalogPrice"}, {"id", "title", "price", "year", "fuel", "provider", "licensePlate", "km", "description", "nameEntry", "place", "province", "endAuction", "ModelInfo", "CatalogPrice"}),
#"Added Custom1" = Table.AddColumn(#"Expanded Data", "age", ea