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 toggle-list-sep | |
| { | |
| $path = "hkcu:\Control Panel\International" | |
| $key = "sList" | |
| $cur_sep = (Get-ItemProperty -path $path -name $key).$key | |
| if ($args.Length -gt 0) { $value = $args[0] } | |
| elseif ($cur_sep -eq ",") { $value = "|" } | |
| else { $value = "," } |
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 getTypeName(value) { | |
| if (value === null) { | |
| return "null"; | |
| } | |
| var t = typeof value; | |
| switch (t) { | |
| case "function": | |
| case "object": | |
| if (value.constructor && value.constructor.name) { |
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
| $hash = @{}; $list = cat .gitmodules | where { $_ -like "*=*" } | foreach { $_.Split("=")[1].Trim() }; while ($list) { $key, $value, $list = $list; $hash[$key]=$value }; $hash.GetEnumerator() | foreach { & git submodule add $_.Value $_.Name } |
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 WebRequestExtensions | |
| { | |
| public static HttpWebRequest CloneRequest(this HttpWebRequest originalRequest, Uri newUri) | |
| { | |
| return CloneHttpWebRequest(originalRequest, newUri); | |
| } | |
| public static WebRequest CloneRequest(this WebRequest originalRequest, Uri newUri) | |
| { | |
| var httpWebRequest = originalRequest as HttpWebRequest; |
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-Project -All | %{ $proj = $_; Get-Package -Project $_.Name | %{ $pkg = $_; Uninstall-Package -Id $pkg.Id -ProjectName $proj.Name -Force; Install-Package -Id $pkg.Id -ProjectName $proj.Name -Version $pkg.Version } } |
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 PSAddMember() { | |
| $this = $args[0] | |
| switch($args.Count) { | |
| 2 { | |
| ($args[1] -as [HashTable]) | %{ $_.GetEnumerator() } | %{ Add-Member -InputObject $this -Name $_.Name -value $_.Value -MemberType Noteproperty -Force -PassThru } | |
| break; | |
| } | |
| 3 { |
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 Where-ObjectMatches() { | |
| [CmdletBinding(DefaultParameterSetName="MatchLike")] | |
| Param( | |
| [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)] | |
| [Alias("Value", "Input", "Object", "io")] | |
| [psobject[]]$InputObject, | |
| [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true,Position=1)] | |
| [Alias("Selector")] | |
| [psobject]$Property, |
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 Get-ArchiveItems { | |
| param([Parameter(Mandatory)][string]$Archive) | |
| function recurse-items { | |
| param([object]$items) | |
| foreach($item in $items) { | |
| $item | |
| $folder = $item.GetFolder | |
| if ($folder) { | |
| recurse-items $folder.Items() |
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 Uninstall-AppFabricCacheNode { | |
| #TODO: Should try and remove the configuration stuff | |
| gwmi win32_product -filter "Name LIKE 'AppFabric%'" |% { | |
| $key="IdentifyingNumber=`"$($_.IdentifyingNumber)`",Name=`"$($_.Name)`",version=`"$($_.Version)`""; | |
| ([wmi]"Win32_Product.$key").uninstall() | |
| } | |
| } | |
| function Reset-AppFabricCacheDatabase { | |
| param( |
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 Start-LocalDb { | |
| [CmdletBinding()] | |
| param( | |
| [Parameter(Mandatory,ValueFromPipeLine,Position=1)] | |
| [psobject[]]$Instance, | |
| [string]$ToolPath = (Find-LocalDbExe) | |
| ) | |
| begin { | |
| } |