Skip to content

Instantly share code, notes, and snippets.

using System.Collections.Generic;
using System.Linq;
using Raven.Client.Documents;
using Raven.Client.Documents.Indexes;
using Raven.Client.ServerWide;
using Raven.Client.ServerWide.Operations;
namespace RavenIssueRepro
{
class Program
@tobiaszuercher
tobiaszuercher / PreDeploy.ps1
Created September 20, 2017 09:39
PreDeploy script to use transformer with octopus deploy
$transformer_exe = Resolve-Path "tools/transformer.exe"
$path = pwd | select -ExpandProperty Path
$args = @("transform", "--environment", $OctopusParameters["Octopus.Environment.Name"], "--path", $path, "--delete-templates")
if ([string]::IsNullOrEmpty($OctopusParameters["transformer.masterkey"]) -eq $false) {
write-host "add password"
$args += "--password"
$args += $OctopusParameters["transformer.masterkey"]
@tobiaszuercher
tobiaszuercher / JwtAuthProviderReaderPatchedForIdentityServer4.cs
Last active July 17, 2017 07:31
Src copy paste of JwtAuthProviderReader with some minor changes to support IdentityServer v4. Changes marked with comment "changed"
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Security.Cryptography;
using ServiceStack;
using ServiceStack.Auth;
using ServiceStack.Configuration;
using ServiceStack.Host;
using ServiceStack.Host.Handlers;
'use strict`
import IReturn = servicestack.IReturn;
import IPromise = angular.IPromise;
import IHttpService = angular.IHttpService;
export class ServiceClient implements IServiceClient {
public static $inject: string[] = ['$http', 'API_BASE_URL'];
@tobiaszuercher
tobiaszuercher / NewRelicTransactionLoggerPlugin.cs
Last active April 26, 2016 08:59
ServiceStack NewRelic transaction + exception logger
/// <summary>
/// Reports transaction names in NewRelic.
/// </summary>
public class NewRelicFeature : IPlugin, IAuthEvents
{
private static readonly ILogger Log = LogManager.GetCurrentClassLogger();
public const string LoginEvent = "login";
public const string LogoutEvent = "logout";
@tobiaszuercher
tobiaszuercher / Update-AssemblyInfo.ps1
Created June 10, 2015 14:47
Update assemblyinfo files.
function Update-AssemblyInfo
{
[CmdletBinding()]
param(
[hashtable] $replacements = $null, # example hastable: @{ AssemblyVersion = "1.3.3.7"; AssemblyFileVersion = "1.3.3.7"; AssemblyInformationalVersion = "TOBI IS COOL <3" }
$path = (Get-Location)
)
$pattern = '(?<={0}\(")[^"]*(?="\))'
@tobiaszuercher
tobiaszuercher / RegexCounter.ps1
Created March 17, 2015 10:00
Regex counter for TeamCity
param(
[string]$path,
[string]$regex,
[string]$name
)
$counter = 0
Get-ChildItem $path -Recurse -Filter "*.cs" | Get-Content | % {
$result = [regex]::Matches($_, $regex, "IgnoreCase")
[Test]
[TestCase("true", "true", "content 1\r\ncontent 2")]
[TestCase("true", "false", "content 1\r\n")]
[TestCase("false", "false", "\r\n")]
[TestCase("${true.condition}", "${true.condition}", "content 1\r\ncontent 2")]
[TestCase("${false.condition}", "${false.condition}", "\r\n")]
public void Multiple_Conditional_Transforming(string condition1, string condition2, string assert)
{
var variableList = new List<Variable>()
{