Skip to content

Instantly share code, notes, and snippets.

@htuomola
htuomola / .gitignore
Last active February 12, 2016 19:02
DocumentDB node.js SDK not passing continuation token properly on query
node_modules
@htuomola
htuomola / Hubs.tt
Last active May 8, 2016 20:41 — forked from robfe/Hubs.tt
A T4 template for generating TypeScript definition files for SignalR hubs. This fork includes minor corrections for using this in VS 2013, MVC 5 project: * Reference the SignalR 2.0 assembly * VS 2013 likes to put TS definition files into subfolders when downloaded from nuget - assuming that this file is directly under /typings/ * TypeScript 0.9…
<#@ template debug="true" hostspecific="true" language="C#" #>
<#@ output extension=".d.ts" #>
<# /* Update this line to match your version of SignalR */ #>
<#@ assembly name="$(SolutionDir)\packages\Microsoft.AspNet.SignalR.Core.2.0.0\lib\net45\Microsoft.AspNet.SignalR.Core.dll" #>
<# /* Load the current project's DLL to make sure the DefaultHubManager can find things */ #>
<#@ assembly name="$(TargetPath)" #>
<#@ assembly name="System.Core" #>
<#@ assembly name="System.Web" #>
<#@ assembly name="System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" #>
<#@ assembly name="System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" #>
@htuomola
htuomola / MsBuildRenameXap.xml
Last active December 21, 2015 12:59
MsBuild target to rename Windows Phone XAP packages after building to include build configuration & assembly version number. Note that as far as I know, it's not possible to delete the original XAP file as it is required for emulator deployment & debugging.
<Target Name="AfterBuild">
<GetAssemblyIdentity AssemblyFiles="$(OutputPath)\$(AssemblyName).dll">
<Output TaskParameter="Assemblies" ItemName="MyAssemblyIdentities" />
</GetAssemblyIdentity>
<PropertyGroup>
<XapFilenameWithoutExt>$(XapFilename.Replace('.xap',''))</XapFilenameWithoutExt>
<OutputXapFilename>$(XapFilenameWithoutExt)_$(Configuration)_%(MyAssemblyIdentities.Version).xap</OutputXapFilename>
</PropertyGroup>
<Message Text="Removing all files matching with '$(XapFilenameWithoutExt)_*.xap'" />
<ItemGroup>
@htuomola
htuomola / ServiceResolverAdapter.cs
Created August 29, 2012 18:09 — forked from haacked/ServiceResolverAdapter.cs
ServiceResolverAdapter: Allows you to use the ASP.NET MVC DependencyResolver for ASP.NET Web API
using System;
using System.Collections.Generic;
using System.Web.Http.Dependencies;
public class ServiceResolverAdapter : IDependencyResolver
{
private readonly System.Web.Mvc.IDependencyResolver dependencyResolver;
public ServiceResolverAdapter(System.Web.Mvc.IDependencyResolver dependencyResolver)
{
@htuomola
htuomola / gist:2768271
Created May 22, 2012 10:45
Get error details from ASMX web service FaultException in WCF
public static string GetErrorMessage(FaultException faultException)
{
string errorMessage;
MessageFault messageFault = faultException.CreateMessageFault();
if (messageFault.HasDetail)
{
var xElement = messageFault.GetDetail<XmlElement>();
string code = GetXmlNodeText(xElement, "/code");
@htuomola
htuomola / UpdateTableWithRowNumbers.sql
Created April 24, 2012 08:18
T-SQL update table with row numbers
WITH cte_Table AS
(
SELECT fieldToUpdate, ROW_NUMBER() OVER (ORDER BY Id) AS rownum
FROM table
)
UPDATE cte_Table
SET fieldToUpdate = rownum