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 replaceInFiles { | |
| param( | |
| [Parameter(Mandatory=$true)] | |
| [string] $filePattern, | |
| [Parameter(Mandatory=$true)] | |
| [string] $findWhat, | |
| [Parameter(Mandatory=$true)] | |
| [string] $replaceWith | |
| ) |
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
| $securestring = Read-Host -AsSecureString "Please enter your password" | |
| $password = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($securestring)) |
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
| cls | |
| $path = 'd:\Git\sp' | |
| $file = '*.csproj' | |
| $regex = "^.*(?=Output).*\.dll</HintPath>" | |
| Get-ChildItem -Path $path -Name $file -Recurse | where {(get-Content $_ | Select-String $regex)} |
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
| if (!Array.prototype.forEach) { | |
| Array.prototype.forEach = function(fn, scope) { | |
| for (var i = 0, len = this.length; i < len; ++i) { | |
| fn.call(scope, this[i], i, this); | |
| } | |
| } | |
| } |
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-Content -path $inputFile) -Replace '"(\d+),(\d{1,})"', '$1.$2' -Replace '"(\d+)"'| Out-File $outputFile |
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
| public static class WpfApplicationExtensions | |
| { | |
| public static void DoEvents(this Application application) | |
| { | |
| if (application != null) | |
| { | |
| application.Dispatcher.Invoke(DispatcherPriority.Background, new ThreadStart(delegate { })); | |
| } | |
| } | |
| } |
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
| Application.Current.Windows.OfType<Window>().SingleOrDefault(x => x.IsActive); |
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 adminMode() { | |
| Start-Process -FilePath "$PSHOME\powershell.exe" -Verb runas -WorkingDirectory $PWD.Path | |
| Exit | |
| } | |
| Set-Alias -Name "elevated" -Value "adminMode" |
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
| param | |
| ( | |
| [string] $inputFile, | |
| [string] $outputFile | |
| ) | |
| if (($inputFile -eq $null) -or ($outputFile -eq $null)) { | |
| "usage: convert_csv_to_json.ps1 [inputFile] [outputFile]" | |
| return; | |
| } |
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
| public static class ThreadExtensions | |
| { | |
| public static bool IsUIThread(this Thread thread) | |
| { | |
| return SynchronizationContext.Current != null; | |
| } | |
| } |