View CSharpDelegates.cs
// This is all pseudo code, never tested, just to give a quick idea of a delegate | |
// Just like you use the "class" keyword to define the characteristic of an object, you can use | |
// "delegate" to define the characteristic of a method. | |
public delegate void PerformDatabaseAction(SqlConnection sqlConn); | |
public static class DatabaseHelpers | |
{ | |
public static void DoDatabaseAction(PerformDatabaseAction theDbAction) | |
{ |
View CSharpKeyWords - Part1 - abstract-virtual-override-new.cs
using System.Collections.Generic; | |
using System.Linq; | |
using System; | |
public static class Program | |
{ | |
public static void Main() | |
{ | |
var dogs = new List<Dog>(); | |
dogs.Add(new Dalmatier()); |
View Convert-ToPackageReference.ps1
Function Convert-ToPackageReference | |
{ | |
Param ( [Parameter( Mandatory, ValueFromPipeline )][String] $inputUri, | |
[String] $stylesheetUri = "https://gist.githubusercontent.com/a4099181/074a6c3dd524ea0d343382137492399c/raw/e2cd1bc88671bb1435569ba9ab1835994aa91725/Convert-ToPackageReference.xsl", | |
[String] $resultsFile = [System.IO.Path]::GetTempFileName() ) | |
Process { | |
$xslt = New-Object System.Xml.Xsl.XslCompiledTransform | |
$xslt.Load( $stylesheetUri ) | |
$xslt.Transform( $inputUri, $resultsFile ) |
View RedirectUsingQueryParameter.html
<html> | |
<head> | |
<script type="text/javascript"> | |
// stolen from: http://stackoverflow.com/questions/11823784/redirection-to-a-specific-web-page-based-on-url-parameter-using-javascript | |
// http://minwinpc/RedirectUsingQueryParameter.html?selection=a | |
function getQueryStringArray(){ | |
var assoc=[]; | |
var items = window.location.search.substring(1).split('&'); | |
for(var j = 0; j < items.length; j++) { |
View TFSAggregator.LastRevisionTest.cs
if(self.Revision == 0) | |
{ | |
// without history, we can't do anything | |
logger.Log("There is not history for this task, quit."); | |
return null; | |
} | |
var treatStates = new[] {"In Progress", "Review"}; | |
var stateKey = "System.State"; | |
var currentState = (string)self.Fields[stateKey].Value; |
View TFSAggregator.Samples.xml
<rule name="AutoOpen" appliesTo="Task"> | |
<!-- Update Work Item to Committed if a task became "active" --> | |
<![CDATA[ | |
if (new[] {"In Progress", "To Do"}.Contains((string)self["System.State"])) | |
{ | |
if(self.HasParent() && (string)self.Parent["System.State"] != "Committed") | |
{ | |
self.Parent.TransitionToState("Committed", "Auto Activated"); | |
} | |
} |
View UpdateStates.policy.xml
<?xml version="1.0" encoding="utf-8"?> | |
<AggregatorConfiguration> | |
<!-- Configure TFS Aggregator behavior. (Once, Optional) | |
- **debug**: turns on debugging options (Optional, default: False) | |
--> | |
<runtime debug="false"> | |
<!-- | |
TBD | |
--> |