This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var exe = FindExePath("pwsh.exe"); | |
var fileInfo = new FileInfo(exe); | |
var smaPath = Path.Combine(fileInfo.DirectoryName, "System.Management.Automation.dll"); | |
Assembly.LoadFrom(smaPath); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$server = Start-UDRestApi -Port 10001 -Endpoint @( | |
New-UDEndpoint -Url 'user' -Method 'GET' -Endpoint { | |
Get-ADUser -LDAPFilter "(objectClass=user)" -ResultSetSize 100 | ConvertTo-Json | |
} | |
) -Force | |
Describe 'Test Mocking' { | |
Context 'Context' { | |
Mock -CommandName 'Get-ADUser' { | |
@( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Import-Module UniversalDashboard | |
Get-UDDashboard | Stop-UDDashboard | |
$Theme = New-UDTheme -Name "test" -Definition @{ | |
'[type="radio"]:checked+label:after, [type="radio"].with-gap:checked+label:after' = @{ | |
'background-color' = 'blue' | |
} | |
'[type="radio"]:checked+label:after, [type="radio"].with-gap:checked+label:before, [type="radio"].with-gap:checked+label:after' = @{ | |
'border' = '2px solid blue' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
New-UDGridLayout -Layout @(@{i = 'test'; x = 0; y = 0; w = 2; h = 2}) -Content { | |
New-UDCard -Id 'test' -Content { "Hello" } -Title "Card" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-UDRestApi | Stop-UDRestApi | |
$Cache:Users = @( | |
[PSCustomObject]@{ Name = "Adam"; Role = "Developer"} | |
[PSCustomObject]@{ Name = "Frank"; Role = "Developer"} | |
[PSCustomObject]@{ Name = "Bill"; Role = "Developer"} | |
) | |
$Endpoints = @() | |
$Endpoints += New-UDEndpoint -Url "user" -Method Get -Endpoint { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Import-Module "F:\universal-dashboard\src\UniversalDashboard\bin\Debug\UniversalDashboard.Community.psd1" | |
$ViewModel = New-UDViewModel -Name "Home" -Members @{ | |
Text = 1 | |
Icon = 'user' | |
Click = New-UDEndpoint -Endpoint { | |
$this.Text++ | |
$this.Icon = 'group' | |
} | |
Clear = New-UDEndpoint -Endpoint { | |
$this.Text = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import stripJsonComments = require('strip-json-comments'); | |
var workbenchSettings = vscode.workspace.getConfiguration("workbench"); | |
var theme = workbenchSettings.colorTheme; | |
var themePath = null; | |
var extension = vscode.extensions.all.find(x => { | |
var extensionTheme = x.packageJSON.contributes.themes && x.packageJSON.contributes.themes.find(y => { | |
return y.label === theme; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-InfluxDb { | |
param( | |
[Parameter()] | |
$Url = 'http://localhost:8086/query?db=performance_data', | |
[Parameter()] | |
$Query | |
) | |
$Results = Invoke-RestMethod -Uri "$Url&q=$Query" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Import-Module UniversalDashboard | |
Get-UDDashboard | Stop-UDDashboard | |
$EI = New-UDEndpointInitialization -Module (Join-Path $PSScriptRoot 'influxdb.psm1') | |
$Cache:NetworkStats = @( | |
'\network adapter(*)\bytes received/sec' | |
'\network adapter(*)\bytes sent/sec' | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
New-Installer -ProductName "Notepad" -UpgradeCode c5b5bcbb-a94f-4490-9746-7563a454357f -OutputDirectory $PSScriptRoot -Content { | |
New-InstallerDirectory -PredefinedDirectoryName AppDataFolder -Content { | |
New-InstallerDirectory -DirectoryName "Notepad" -Content { | |
New-InstallerFile -Source (Join-Path $PSScriptRoot "notepad.ps1") -Id "Notepadps1" | |
} | |
} | |
} -CustomAction @( | |
New-InstallerCustomAction -FileId "Notepadps1" -RunOnInstall -CheckReturnValue | |
) |