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
private static string GetAssemblyDirectory() | |
{ | |
return new System.IO.FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).Directory.FullName; | |
} |
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
public static class ThreadExtensions | |
{ | |
public static bool IsUIThread(this Thread thread) | |
{ | |
return SynchronizationContext.Current != null; | |
} | |
} |
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
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 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 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 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 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 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 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 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)) |
OlderNewer