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 UpdateVcxprojFile($filename) { | |
$content = [xml](Get-Content -Path $filename) | |
$changed = $false | |
$toolsVersion = $content.Project.ToolsVersion | |
if ($toolsVersion -ne "12.0") { | |
$content.Project.ToolsVersion = "12.0" | |
$changed = $true | |
} | |
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.Diagnostics; | |
using System.Net; | |
namespace ConsoleApplication1 { | |
internal class Program { | |
private const int COUNT = 20; | |
private static void Main() { | |
var urls = new[] { |
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-NuGetPackageFolder { | |
param( | |
[string] $package_name, | |
[string] $nuget_packages_config | |
) | |
$xml = [xml](gc $nuget_packages_config) | |
$package = $xml.packages.package | where { $_.id -eq $package_name } | |
Join-Path $packages_dir ($package_name + "." + $package.version) | |
} |
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
# Helper script for those who want to run psake without importing the module. | |
# Example: | |
# .\psake.ps1 "default.ps1" "BuildHelloWord" "4.0" | |
# Must match parameter definitions for psake.psm1/invoke-psake | |
# otherwise named parameter binding fails | |
param( | |
[Parameter(Position=0,Mandatory=0)] | |
[string]$buildFile = 'default.ps1', | |
[Parameter(Position=1,Mandatory=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
function Expand-ZipFile { | |
param { | |
$zipPath, | |
$destination, | |
[switch] $quiet | |
} | |
$shellApplication = new-object -com shell.application | |
$zipPackage = $shellApplication.NameSpace($zipPath) | |
$destinationFolder = $shellApplication.NameSpace($destination) |
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
# red background if running elevated | |
& { | |
$wid=[System.Security.Principal.WindowsIdentity]::GetCurrent() | |
$prp=new-object System.Security.Principal.WindowsPrincipal($wid) | |
$adm=[System.Security.Principal.WindowsBuiltInRole]::Administrator | |
$IsAdmin=$prp.IsInRole($adm) | |
if ($IsAdmin) | |
{ | |
(get-host).UI.RawUI.Backgroundcolor="DarkRed" | |
clear-host |
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 HttpContextBase FakeHttpContext() { | |
var context = new Mock<HttpContextBase>(); | |
var files = new Mock<HttpFileCollectionBase>(); | |
var request = new Mock<HttpRequestBase>(); | |
var response = new Mock<HttpResponseBase>(); | |
var session = new Mock<HttpSessionStateBase>(); | |
var server = new Mock<HttpServerUtilityBase>(); | |
var user = new Mock<IPrincipal>(); | |
var identity = new Mock<IIdentity>(); | |
request.Setup(req => req.ApplicationPath).Returns("~/"); |
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
class Program { | |
static void Main(string[] args) { | |
using (var store = new EmbeddableDocumentStore { RunInMemory = true }) { | |
store.Initialize(); | |
using (var session = store.OpenSession()) { | |
session.Store(new Document { Path = "a" }); | |
session.Store(new Document { Path = "a/b" }); | |
session.Store(new Document { Path = "a/b/c" }); | |
session.Store(new Document { Path = "a/d" }); |
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
<?xml version="1.0" encoding="utf-8"?> | |
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<!-- make all references non-private, so they won't be copied to the output folder --> | |
<Target Name="ClearReferenceCopyLocalPaths" AfterTargets="ResolveAssemblyReferences"> | |
<ItemGroup> | |
<ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)" /> | |
</ItemGroup> | |
</Target> |
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
# | |
# Add the SQL Server Provider. | |
# Source: http://technet.microsoft.com/en-us/library/cc281962(v=sql.105).aspx | |
# | |
$ErrorActionPreference = "Stop" | |
$sqlpsreg="HKLM:\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.SqlServer.Management.PowerShell.sqlps" | |
if (Get-ChildItem $sqlpsreg -ErrorAction "SilentlyContinue") |
OlderNewer