-
-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Add specific error for Show-Advice (#287)
* ✨ Add specific error for Show-Advice * Update PSKoans/Public/Show-Advice.ps1 Co-Authored-By: Joel Sallow (/u/ta11ow) <32407840+vexx32@users.noreply.github.com> * Update PSKoans/Public/Show-Advice.ps1 Co-Authored-By: Joel Sallow (/u/ta11ow) <32407840+vexx32@users.noreply.github.com> * Update PSKoans/Public/Show-Advice.ps1 Co-Authored-By: Joel Sallow (/u/ta11ow) <32407840+vexx32@users.noreply.github.com> * Update PSKoans/Public/Show-Advice.ps1 Co-Authored-By: Joel Sallow (/u/ta11ow) <32407840+vexx32@users.noreply.github.com> * Adjust tests to new errors * Remove unnecessary var initialization
- Loading branch information
Showing
8 changed files
with
153 additions
and
96 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,4 @@ | |
"To create or open the profile file, simply run:", | ||
" notepad $profile" | ||
] | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
{ | ||
"Title": "Fun with Cat Facts", | ||
"Content": [ | ||
"PowerShell doesn't have to all be about Server administration, ops, or automation.", | ||
"\n", | ||
"It can also be fun!", | ||
"\n", | ||
"We've provided some fun examples below just to give you a taste of what PowerShell can do", | ||
"Cats", | ||
"\n", | ||
" The below code snippit will query a RESTAPI on the internet that provides some fun facts about cats. It then uses the SpeechSynthesizer to tell you these facts! Feel free to run it on your machine:", | ||
"\n", | ||
"function Get-CatFact {", | ||
"\n", | ||
"\tAdd-Type -AssemblyName System.Speech", | ||
"\t$SpeechSynth = New-Object System.Speech.Synthesis.SpeechSynthesizer", | ||
"\t$URI = 'http://www.catfact.info/api/v1/facts.json?per_page=200'", | ||
"\t$Random = Get-Random -Maximum 200", | ||
"\t$CatFact = (ConvertFrom-Json (Invoke-WebRequest -Uri $URI)).Facts[$Random]", | ||
"\t$SpeechSynth.Speak('did you know?')", | ||
"\t$SpeechSynth.Speak($CatFact.details)", | ||
"}", | ||
"\n", | ||
"Get-CatFact" | ||
] | ||
"Title": "Fun with Cat Facts", | ||
"Content": [ | ||
"PowerShell doesn't have to all be about Server administration, ops, or automation.", | ||
"\n", | ||
"It can also be fun!", | ||
"\n", | ||
"We've provided some fun examples below just to give you a taste of what PowerShell can do", | ||
"Cats", | ||
"\n", | ||
" The below code snippit will query a RESTAPI on the internet that provides some fun facts about cats. It then uses the SpeechSynthesizer to tell you these facts! Feel free to run it on your machine:", | ||
"\n", | ||
"function Get-CatFact {", | ||
"\n", | ||
"\tAdd-Type -AssemblyName System.Speech", | ||
"\t$SpeechSynth = New-Object System.Speech.Synthesis.SpeechSynthesizer", | ||
"\t$URI = 'http://www.catfact.info/api/v1/facts.json?per_page=200'", | ||
"\t$Random = Get-Random -Maximum 200", | ||
"\t$CatFact = (ConvertFrom-Json (Invoke-WebRequest -Uri $URI)).Facts[$Random]", | ||
"\t$SpeechSynth.Speak('did you know?')", | ||
"\t$SpeechSynth.Speak($CatFact.details)", | ||
"}", | ||
"\n", | ||
"Get-CatFact" | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,37 @@ | ||
{ | ||
"Title": "Fun with GUIs", | ||
"Content": [ | ||
"PowerShell doesn't have to all be about Server administration, ops, or automation.", | ||
"It can also be fun!", | ||
"\n", | ||
"We've provided some fun examples below just to give you a taste of what PowerShell can do", | ||
"\n", | ||
"GUIs", | ||
"\n", | ||
"\tThe below code snippit will make a blue GUI. When you're more experienced you may", | ||
"\twant to start making GUIs for your scripts. This is just a quick example.", | ||
"\n", | ||
"\tCopy the below into PowerShell ISE to create the GUI!", | ||
"\n", | ||
"# Import Assemblies ", | ||
"[void] [System.Reflection.Assembly]::LoadWithPartialName('System.Drawing')", | ||
"[void] [System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms')", | ||
"\n", | ||
"\n", | ||
"# Create a new form object and assign it to the variable GUIExample", | ||
"$GUIExample = New-Object System.Windows.Forms.Form", | ||
"\n", | ||
"# Define the background image and then set the form to be the same height/width as the image", | ||
"$BackgroundImage = [System.Drawing.Image]", | ||
"$GUIExample.BackColor = 'Blue'", | ||
"$GUIExample.Width = 200", | ||
"$GUIExample.Height = 400", | ||
"\n", | ||
"# Make the GUI the topmost window and give it focus (make it the selected window)", | ||
"$GUIExample.TopMost = $True", | ||
"$GUIExample.Add_Shown({$GUIExample.Activate()})", | ||
"\n", | ||
"# Show the GUI", | ||
"[void]$GUIExample.ShowDialog()" | ||
] | ||
"Title": "Fun with GUIs", | ||
"Content": [ | ||
"PowerShell doesn't have to all be about Server administration, ops, or automation.", | ||
"It can also be fun!", | ||
"\n", | ||
"We've provided some fun examples below just to give you a taste of what PowerShell can do", | ||
"\n", | ||
"GUIs", | ||
"\n", | ||
"\tThe below code snippit will make a blue GUI. When you're more experienced you may", | ||
"\twant to start making GUIs for your scripts. This is just a quick example.", | ||
"\n", | ||
"\tCopy the below into PowerShell ISE to create the GUI!", | ||
"\n", | ||
"# Import Assemblies ", | ||
"[void] [System.Reflection.Assembly]::LoadWithPartialName('System.Drawing')", | ||
"[void] [System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms')", | ||
"\n", | ||
"\n", | ||
"# Create a new form object and assign it to the variable GUIExample", | ||
"$GUIExample = New-Object System.Windows.Forms.Form", | ||
"\n", | ||
"# Define the background image and then set the form to be the same height/width as the image", | ||
"$BackgroundImage = [System.Drawing.Image]", | ||
"$GUIExample.BackColor = 'Blue'", | ||
"$GUIExample.Width = 200", | ||
"$GUIExample.Height = 400", | ||
"\n", | ||
"# Make the GUI the topmost window and give it focus (make it the selected window)", | ||
"$GUIExample.TopMost = $True", | ||
"$GUIExample.Add_Shown({$GUIExample.Activate()})", | ||
"\n", | ||
"# Show the GUI", | ||
"[void]$GUIExample.ShowDialog()" | ||
] | ||
} |
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,4 @@ | |
" Set-PSReadlineOption -EditMode Vi", | ||
" Set-PSReadlineOption -EditMode Windows" | ||
] | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,32 @@ | ||
{ | ||
"Title": "Object-Orientated Programming (OOP) Introduction", | ||
"Content": [ | ||
|
||
"PowerShell is an object-oriented shell, but what does this mean? Everything is an object!", | ||
"\n", | ||
"Objects are a way for us to build programs to scale, and OOP is standard in software development. There are three fundamentals you need to know:", | ||
"\n", | ||
"\t1. Objects have defined types, which are like blueprints", | ||
"\t2. Objects store data in properties", | ||
"\t3. Objects have methods which can be called to perform an action", | ||
"\n", | ||
"If you've already completed the Get-Member topic, then you'll know we can use this cmdlet to discover what blueprint an object is using, what properties it has, and what methods it may execute. For example, we may take a string and pass it into Get-Member in order to get the below result:", | ||
"\n", | ||
"\t\tTypeName: System.String", | ||
"\n", | ||
"\tName MemberType Definition", | ||
"\t---- ---------- ----------", | ||
"\tClone Method System.Object Clone(), System.Object ICloneable.Clone()", | ||
"\tLength Property int Length {get;}", | ||
"\n", | ||
"Which shows us the object type (System.String), as well as some properties and methods.", | ||
"\n", | ||
"For more information please see the below articles on OOP concepts:", | ||
"\n", | ||
"\t Abstraction: https://stackify.com/oop-concept-abstraction/", | ||
"\t Encapsulation: https://stackify.com/oop-concept-for-beginners-what-is-encapsulation/", | ||
"\t Inheritance: https://stackify.com/oop-concept-inheritance/", | ||
"\t Polymorphism: https://stackify.com/oop-concept-polymorphism/", | ||
"\n", | ||
"The .NET Core API browser may also be useful given that .NET is the foundation on which PowerShell is built: https://docs.microsoft.com/en-us/dotnet/api/?view=netcore-3.0" | ||
] | ||
"Title": "Object-Orientated Programming (OOP) Introduction", | ||
"Content": [ | ||
"PowerShell is an object-oriented shell, but what does this mean? Everything is an object!", | ||
"\n", | ||
"Objects are a way for us to build programs to scale, and OOP is standard in software development. There are three fundamentals you need to know:", | ||
"\n", | ||
"\t1. Objects have defined types, which are like blueprints", | ||
"\t2. Objects store data in properties", | ||
"\t3. Objects have methods which can be called to perform an action", | ||
"\n", | ||
"If you've already completed the Get-Member topic, then you'll know we can use this cmdlet to discover what blueprint an object is using, what properties it has, and what methods it may execute. For example, we may take a string and pass it into Get-Member in order to get the below result:", | ||
"\n", | ||
"\t\tTypeName: System.String", | ||
"\n", | ||
"\tName MemberType Definition", | ||
"\t---- ---------- ----------", | ||
"\tClone Method System.Object Clone(), System.Object ICloneable.Clone()", | ||
"\tLength Property int Length {get;}", | ||
"\n", | ||
"Which shows us the object type (System.String), as well as some properties and methods.", | ||
"\n", | ||
"For more information please see the below articles on OOP concepts:", | ||
"\n", | ||
"\t Abstraction: https://stackify.com/oop-concept-abstraction/", | ||
"\t Encapsulation: https://stackify.com/oop-concept-for-beginners-what-is-encapsulation/", | ||
"\t Inheritance: https://stackify.com/oop-concept-inheritance/", | ||
"\t Polymorphism: https://stackify.com/oop-concept-polymorphism/", | ||
"\n", | ||
"The .NET Core API browser may also be useful given that .NET is the foundation on which PowerShell is built: https://docs.microsoft.com/en-us/dotnet/api/?view=netcore-3.0" | ||
] | ||
} |
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 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