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
void Main() | |
{ | |
WorkItemReporter.GetTestCoverageReport(typeof(MyTest).Assembly).Dump(); | |
} | |
// Define other methods and classes here | |
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)] | |
public class WorkItemAttribute : Attribute | |
{ | |
public WorkItemAttribute(WorkItemType workItemType, string id) |
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
#32 bit path - "hklm:\software\microsoft\windows\currentversion\uninstall" | |
$regInstallPath = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\" | |
$installed = gci $regInstallPath | | |
foreach { gp $_.PSPath } | | |
select DisplayVersion,InstallDate,ModifyPath,Publisher,UninstallString,Language,DisplayName | | |
where { ($_.DisplayName -ne $null) -and ($_.DisplayName -ne "") } |
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
/// <reference path="~/Scripts/ThirdParty/knockout-2.1.0.debug.js" /> | |
/// <reference path="~/Scripts/ThirdParty/moment.js" /> | |
function YearSelector(earliestDate, latestDate) { | |
var self = this; | |
self.earliestDate = earliestDate; | |
self.latestDate = latestDate; | |
var getYears = function () { | |
var years = []; |
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 (Html.BeginForm()) | |
{ | |
@Html.TextArea("content") | |
<input type="submit" value="Send it!" /> | |
} | |
@if (ViewBag.SentMessage != 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
public class FakeControllerContext : ControllerContext | |
{ | |
public FakeControllerContext(IController controller) | |
: this(controller, null, null, null, null, null, null) | |
{ | |
} | |
public FakeControllerContext(IController controller, HttpCookieCollection cookies) | |
: this(controller, null, null, null, null, cookies, 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
function Poll-Website([string]$uri){ | |
$status = "" | |
$retryCount = 0; | |
while($status -ne "OK" -and $retryCount -le 5){ | |
try{ | |
$status = (Invoke-WebRequest -Uri $uri).StatusDescription | |
Write-Host $status | |
} | |
catch | |
{ |
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.Web.Mvc; | |
public class HomeController : Controller | |
{ | |
public ActionResult Index() | |
{ | |
if (User.Identity.IsAuthenticated) | |
ViewBag.Message = "User = " + User.Identity.Name; | |
else | |
ViewBag.Message = "AnonymousID = " + Request.AnonymousID; |
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
#Set environment variables for Visual Studio Command Prompt | |
pushd 'c:\Program Files (x86)\Microsoft Visual Studio 11.0\VC' | |
cmd /c "vcvarsall.bat&set" | | |
foreach { | |
if ($_ -match "=") { | |
$v = $_.split("="); set-item -force -path "ENV:\$($v[0])" -value "$($v[1])" | |
} | |
} | |
popd | |
write-host "`nVisual Studio 2012 Command Prompt variables set." -ForegroundColor Yellow |
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 Select-UniqueChildrenWithStringPattern { | |
param($path, $pattern) | |
Get-ChildItem $path -Recurse -exclude *.exe,*.dll,*.pdb,*.jpg,*.png,*.gif,*.mst,*.msi,*.msm,*.gitignore,*.idx,*.pack,*.suo,*.ico,*.nupkg,*.zip,*.7z | | |
Select-String -Pattern $pattern | | |
Where-Object { $_ -ne $null } | | |
Select-Object Path -Unique | |
} | |
function String-ReplaceRecursive { | |
param($path, $pattern, $replaceValue) |
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
void Main() | |
{ | |
//turn response codes into enum values | |
var things = GetData().Select (x =>{ | |
var id = GetNumberFromStart(x); | |
var name = ConvertToVariable(x.Replace(id.ToString(),string.Empty)); | |
return string.Format("{0} = {1},",id,name); | |
} ); | |
things.Dump(); | |
} |