Skip to content

Instantly share code, notes, and snippets.

View newdigate's full-sized avatar

Nic Newdigate newdigate

View GitHub Profile
@newdigate
newdigate / gist:b2f2d3c96daf0ab26260
Last active August 29, 2015 14:21
SQLServer Dynamic Revision Table DDL Generator
CREATE FUNCTION dbo.genRevTableColumnsDDL( @TableName AS VARCHAR(40) ) RETURNS VARCHAR(MAX)
AS
BEGIN
DECLARE @sql NVARCHAR(MAX) = N'';
SELECT @sql += CASE
WHEN column_ordinal = 1 AND UPPER(name) = 'ID' THEN
CHAR(9) + '[ID]'+ CHAR(9) + 'BIGINT' + CHAR(9) + 'NOT NULL PRIMARY KEY IDENTITY,' + CHAR(13) + CHAR(10) +
CHAR(9) + '['+@TableName+'ID]'+ CHAR(9) + 'BIGINT' + CHAR(9) + 'NOT NULL,' + CHAR(13) + CHAR(10)
ELSE
CHAR(9) + '[' + name + '] ' + system_type_name + ' NULL,'+ CHAR(13) + CHAR(10)

###This repository contains submodules.

  • Clone it with git clone --recursive
  • If you forgot, run git submodule update --init --recursive

Summer Dreaming (bacardi) - what a feeling to be dreaming never been so easy

@newdigate
newdigate / macosx-developer.md
Last active October 16, 2015 09:56
Tools to install for macosx development
xcode
  • install xcode via appstore, then open terminal and run
sudo xcodebuild -license
node.js
homebrew
@newdigate
newdigate / Install-gyp.md
Created October 16, 2015 12:29
how to install gyp (on macosx)
@newdigate
newdigate / PerRequestLifetimeManager.md
Last active November 21, 2015 11:53
Entity Framework not disposing DbContext correctly. #entity-framework
var lifetime = new PerRequestLifetimeManager();
container.RegisterType<DbContext, EntitiesDbContext>(lifetime);
Microsoft.Web.Infrastructure.DynamicModuleHelper.DynamicModuleUtility.RegisterModule(typeof(UnityPerRequestHttpModule));
@newdigate
newdigate / TFSCheckoutChangedFiles.MD
Last active November 21, 2015 11:58
Checkout changed files - TFS is EVIL (again) #tfs
@newdigate
newdigate / Undo unchanged recursive.md
Last active November 21, 2015 11:59
Microsoft TFS (Team foundation server) is an evil bastard! #tfs
tfpt uu . /noget /recursive
@newdigate
newdigate / TPLAudioAmp.cs
Last active December 18, 2015 14:36
TaskParallel audio amp
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
namespace TaskParallel
{
public class Class1
{