Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
[System.Text.RegularExpressions.MatchCollection]$classesAndIds = [regex]::Matches($html, 'class="(?<Classes>[^"]+)"|id="(?<Id>[^"]+)"') | |
$classes = [System.Collections.Generic.HashSet[string]]::new() | |
$ids = [System.Collections.Generic.HashSet[string]]::new() | |
$classesAndIds.Captures.Groups.ForEach{ | |
if ($_.Name -eq 'Classes') { | |
$_.Value -split '[\s\r\n]' -replace '\{/?block:[^}]\}' | | |
Where-Object {$_} | | |
ForEach-Object { |
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-Age { | |
[CmdletBinding()] | |
param( | |
[Parameter(Mandatory)] | |
[ValidateScript( | |
{ | |
$_ -lt [datetimeoffset]::UtcNow | |
} | |
)] | |
[datetimeoffset] |
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
$Object = ConvertFrom-Json '{ "base_url": "https://foo.bar" }' | |
$Properties = foreach ($property in $Object.PSObject.Properties) { | |
$newNameFragments = @($property.Name -split '_').ForEach{ | |
[CultureInfo]::CurrentCulture.TextInfo.ToTitleCase($_) | |
} | |
# Select-Object property rename via selector hashtable; Name is the new name, Expression is the original name | |
@{ Name = -join $newNameFragments; Expression = $property.Name } | |
} |
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
internal static float GetEnclosedArea(this SKPath path) | |
{ | |
SKRect bounds = path.TightBounds; | |
var boundedArea = bounds.Width * bounds.Height; | |
var totalPoints = 10000; | |
var enclosedPoints = 0; | |
for (float x = bounds.Left; x < bounds.Right; x += bounds.Width / (float)Math.Sqrt(totalPoints)) | |
{ | |
for (float y = bounds.Top; y < bounds.Bottom; y += bounds.Height / (float)Math.Sqrt(totalPoints)) |