This file contains 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 Add-ToPath{ | |
param( | |
[parameter(Mandatory=$true,position=0)][string] $pathToAdd | |
) | |
if(-NOT ($env:path.Contains($pathToAdd))) | |
{ | |
Write-Host "Adding '$pathToAdd' to your Environment Path." | |
$env:path += ";$pathToAdd" | |
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value $env:path |
This file contains 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
$apiKey = "Your API Key" | |
$OctopusURL = "Your Octopus URL" | |
$Header = @{ "X-Octopus-ApiKey" = $apiKey } | |
#Getting all machines given an Environment name | |
$EnvironmentName = Read-Host 'What environment do you want to wipe out?' | |
Write-Warning "You are about to remove ALL machines from the $EnvironmentName environment." | |
$confirm = Read-Host 'Are you sure you want to continue? Y/N' |
This file contains 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-FullName { | |
param( | |
[parameter(position=0, parametersetname="a")] [string] $firstName, | |
[parameter(position=1, parametersetname="a")] [string] $lastName, | |
[parameter(position=0, parametersetname="b")] [hashtable] $name | |
) | |
if($PSCmdlet.ParameterSetName -eq 'b') { | |
# Doing recursion will allow for parameter validation if need be! | |
Get-FullName $name.first $name.last |
This file contains 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 Add-Post { | |
param ( | |
[parameter(Mandatory=$true, Position=0)][string]$post, | |
[parameter(Mandatory=$false, Position=1)][switch]$draft | |
) | |
if(!(Assert-IsGitRepo)) { | |
throw 'you are currently not in a git repository.' | |
} | |
This file contains 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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Threading.Tasks; | |
using System.Windows.Input; | |
using Xamarin.Forms; | |
namespace TimeTracker.Controls | |
{ | |
public class GridView : Grid |
This file contains 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 MyAwesomeModule | |
.\out-html.ps1 -moduleName 'MyAwesomeModule' -outputDir "path\to\output" |
This file contains 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
source ~/.git-completion.bash | |
source ~/.git-prompt.sh | |
alias edit='open -a visual\ studio\ code' | |
alias cd..='cd ..' | |
alias co='git checkout' | |
alias pull='git fetch;git pull' | |
alias chr='open -a Google\ Chrome' | |
alias projects='cd ~/Projects' |
This file contains 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
[ | |
{ "key": "ctrl+f4", "command": "workbench.action.closeActiveEditor" } | |
] |
This file contains 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
.md *{ | |
font-size: 12pt; | |
font-family: monospace; | |
font-weight: normal; | |
font-style: normal; | |
text-decoration: none; | |
color: black; | |
cursor: default; | |
} | |
.md h1::before { content: "# "; } |
This file contains 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
# this is the final (child) function being called | |
function Invoke-Foo { | |
[cmdletbinding()] | |
param([switch] $Custom) | |
Write-Host 'Hello world' | |
Write-Verbose 'I''m a verbose message' | |
Write-Debug 'I''m a debug message' #this will pause execution | |
if($Custom.IsPresent){ | |
Write-Host 'I''m a custom message' |