Skip to content

Instantly share code, notes, and snippets.

View tomkuijsten's full-sized avatar

Tom Kuijsten tomkuijsten

View GitHub Profile
<?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
-->
<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");
}
}
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;
@tomkuijsten
tomkuijsten / RedirectUsingQueryParameter.html
Last active October 18, 2016 19:06
Html which redirects to another url based on query param
<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++) {
@tomkuijsten
tomkuijsten / Convert-ToPackageReference.ps1
Created September 7, 2017 06:59 — forked from a4099181/Convert-ToPackageReference.ps1
Converts packages.config into PackageReference at *.csproj project file. Requires XSLT stylesheet available as second file in the gist.
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 )
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());
// 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)
{
using System.Collections.Concurrent;
namespace ServiceBus.Extensions.Bindings.MessageActions;
/// <summary>
/// Runs on every request and passes the function context (e.g. Http request and host configuration) to a value provider.
/// </summary>
public class MessageActionsExtendedBinding : IBinding
{
private static ConcurrentDictionary<string, string> _functionNameWithQueueOrTopicNameCache = new ConcurrentDictionary<string, string>();
namespace ServiceBus.Extensions.Bindings.MessageActions;
public class MessageActionsExtended
{
private const string RETRY_COUNT = "X-RetryCount";
private readonly ServiceBusMessageActions _messageActions;
private readonly ServiceBusSender _sender;
// Summary: