Skip to content

Instantly share code, notes, and snippets.

View AndrewAllison's full-sized avatar

Andy Allison AndrewAllison

View GitHub Profile
@AndrewAllison
AndrewAllison / gist:3dade9a6e71f1c225466
Created October 6, 2015 05:31 — forked from tjrobinson/gist:0ad6c790e90d7a385eb1
ActiveDirectoryUserService.cs
using System;
using System.Collections.Generic;
using System.DirectoryServices.AccountManagement;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using Thinktecture.IdentityServer.Core;
using Thinktecture.IdentityServer.Core.Models;
using Thinktecture.IdentityServer.Core.Services;
@AndrewAllison
AndrewAllison / index.html
Created April 24, 2015 09:21
Gulp examples
<!DOCTYPE html>
<html ng-app="app">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" />
<title ng-bind="title"></title>
<base href="/">
<style>
@AndrewAllison
AndrewAllison / C# Class from DB object in sql
Last active April 29, 2016 11:40
Create a C# class from DB Table. String output, ready to copy and past..
declare @TableName sysname = 'DBTableName'
declare @result varchar(max) = 'public class ' + @TableName + '
{'
select @result = @result
+ CASE WHEN ColumnDesc IS NOT NULL THEN '
/// <summary>
/// ' + ColumnDesc + '
/// </summary>' ELSE '' END
+ '
public ' + ColumnType + ' ' + ColumnName + ' { get; set; }'
@AndrewAllison
AndrewAllison / Modifypath.ps1
Created January 6, 2015 13:32
Modify Powershell Path for Modules folder
$CurrentValue = [Environment]::GetEnvironmentVariable("PSModulePath", "Machine")
[Environment]::SetEnvironmentVariable("PSModulePath", $CurrentValue + ";E:\Powershell", "Machine")
public static class EnumerableExtensions
{
public static IEnumerable<TSource> Distinct<TSource>(this IEnumerable<TSource> enumerable, Func<TSource, TSource, bool> comparer)
{
return enumerable.Distinct(new LambdaComparer<TSource>(comparer));
}
public static IEnumerable<TSource> Except<TSource>(this IEnumerable<TSource> first, IEnumerable<TSource> second, Func<TSource, TSource, bool> comparer)
{
return first.Except(second, new LambdaComparer<TSource>(comparer));