Skip to content

Instantly share code, notes, and snippets.

View roughiain's full-sized avatar

Iain Rough roughiain

View GitHub Profile
@roughiain
roughiain / phoneMasks.json
Created January 8, 2024 05:52 — forked from mikemunsie/phoneMasks.json
Phone Masks by Country Code JSON
{
"AC": "+247-####",
"AD": "+376-###-###",
"AE": "+971-5#-###-####",
"AE": "+971-#-###-####",
"AF": "+93-##-###-####",
"AG": "+1(268)###-####",
"AI": "+1(264)###-####",
"AL": "+355(###)###-###",
"AM": "+374-##-###-###",
@roughiain
roughiain / dictionaryValidator.md
Created May 18, 2023 07:26
SampleModels for issue with dictionary and fluent variation
public class SomeThingSomething
{
     public string Name { get; set; } = "";
    
     public Dictionary<SomeEnum, SomeDetail> SomeDict { get; set; } = new();
  
}
@roughiain
roughiain / NotNullWhenTrueAttribute.md
Created January 19, 2023 14:24
NotNullWhenTrueAttribute for custom try parse
    public bool TryParseDirectoryPath(string pathtoValidate, [NotNullWhen(true)] out string? validDirectoryPath)

reference link

@roughiain
roughiain / wsl2config.md
Created November 23, 2020 05:27
WSL2 Config

c:\users\*your your profile name* and creating a .wslconfig

[wsl2]
memory=4GB # Limits VM memory in WSL 2 to 4 GB
processors=5 # Makes the WSL 2 VM use two virtual processors

@roughiain
roughiain / Kendo.Password.md
Last active October 5, 2020 07:18
Kendo Password Template with explanation

Kendo Password Template with explanation.

Model for example.

public class User
{
  public int Id { get; set; }

 public string Name { get; set; }
@roughiain
roughiain / UpdateIISExpressCertificate.ps1
Last active August 24, 2017 10:19 — forked from camieleggermont/UpdateIISExpressCertificate.ps1
This powershell script generates a new certificate, removes the old certificate assignments from the IISExpress ssl ports and adds the newly generated one. The certificate is also copied over to the Trusted Root Certificate Authorities.
If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
{
$arguments = "& '" + $myinvocation.mycommand.definition + "'"
Start-Process powershell -Verb runAs -ArgumentList $arguments
Break
}
$cert = New-SelfSignedCertificate -DnsName "localhost", "localhost" -CertStoreLocation "cert:\LocalMachine\My" -NotAfter (Get-Date).AddYears(5)
$thumb = $cert.GetCertHashString()