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 interface IOrderMe | |
{ | |
Order PreferredOrder(); | |
// or somethign like "void OrderMe(OrderContext relativeToOtherItems);" | |
} | |
public abstract class Order | |
{ |
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
while($true){ | |
$query = "SELECT * FROM Msvm_ComputerSystem " | |
$VM = get-wmiobject -query $query -namespace "root\virtualization" -computername "." | |
$vmToRestart = $vm | where-object { $_.ElementName -ne "YOUR HOSTNAME"} |sort TimeOfLastStateChange | select-object -Index 0 | |
$vmToRestart | |
$vmToRestart.RequestStateChange(3) | |
start-sleep -seconds 120 | |
$vmToRestart.RequestStateChange(2) | |
start-sleep -Seconds 300 | |
} |
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 outputResults($resultsFile, $verbose) | |
{ | |
$list = @() | |
$xml = [xml](get-content $resultsFile) | |
$failures = $xml.TestRun.Results.UnitTestResult | where {$_.outcome -eq "Failed" } | select testId | |
if ($failures.Count -gt 0) | |
{ | |
foreach ($test in $failures) | |
{ | |
$name = "" |
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 global:aspcomp() | |
{ | |
$dir = Join-Path $solutionScriptsContainer "..\Your.Web.Project" -Resolve | |
$bin = Join-Path $dir "bin" | |
$compiler = Join-Path $([System.Runtime.InteropServices.RuntimeEnvironment]::GetRuntimeDirectory()) "aspnet_compiler.exe" | |
& $compiler -p $dir -v $bin | |
} |
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 ActionResult Index() | |
{ | |
try | |
{ | |
var tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(_tfs)); | |
tfs.Connect(ConnectOptions.None); | |
ViewBag.Message = "It's just you."; | |
} | |
catch (Exception) |
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 abstract class Entity | |
{ | |
protected Entity() | |
{ | |
Created = SystemTime.InternalNow(); | |
Updated = SystemTime.InternalNow(); | |
} | |
[Key] | |
public long Id { get; set; } |
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
// tristate.js | |
// usage: $('.child').tristate({ parent: '#master' }); | |
(function ($) { | |
$.fn.tristate = function (options) { | |
var defaults = { | |
checkedClass: 'checked', | |
uncheckedClass: 'unchecked', |
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 Querier : IQuerier | |
{ | |
readonly IContainer _container; | |
public Querier(IContainer container) | |
{ | |
_container = container; | |
} | |
public T GetResult<T>(IQuery<T> query) |
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.Collections.Generic; | |
using System.Data.Entity; | |
public static class Effin | |
{ | |
public static IEnumerable<T> Query<T>(this string connectionStringName, string sql, params object[] parameters) | |
{ | |
return new DbContext(connectionStringName).Database.SqlQuery<T>(sql, parameters); | |
} |
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 InitializerExtensions { | |
public static IDatabaseInitializer<T> ShowSql<T>(this IDatabaseInitializer<T> initializer) where T : DbContext { | |
return new OutputtingInitializerDecorator<T>(initializer); | |
} | |
} | |
public class OutputtingInitializerDecorator<T> : IDatabaseInitializer<T> where T : DbContext { | |
readonly IDatabaseInitializer<T> _inner; | |
public OutputtingInitializerDecorator(IDatabaseInitializer<T> inner) { |