Skip to content

Instantly share code, notes, and snippets.

View tjrobinson's full-sized avatar

Tom Robinson tjrobinson

View GitHub Profile
@tjrobinson
tjrobinson / svn-ignore
Created January 2, 2013 11:16
Subversion global ignores
### Set global-ignores to a set of whitespace-delimited globs
### which Subversion will ignore in its 'status' output, and
### while importing or adding files and directories.
global-ignores = *.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#* .DS_Store *.dat bin Bin obj Obj *.user *.suo *.sln.cache *.xap licences.licx licenses.licx _ReSharper.* *.resharper* *.g.cs ~$* StyleCop.Cache *.DotSettings
@tjrobinson
tjrobinson / gist:5117565
Created March 8, 2013 16:12
AppDomain.CurrentDomain.AssemblyResolve
AppDomain.CurrentDomain.AssemblyResolve += (s, ea) => ea.Name.StartsWith("NHibernate,") ? Assembly.GetAssembly(typeof(NHibernate.ISession)) : null;
@tjrobinson
tjrobinson / gist:5151618
Last active December 14, 2015 21:29
Get TODOs
$head = "<style>
body {
color: #151515;
font-family: helvetica neue,arial,sans-serif;
font-size: 82%;
line-height: 1.5em;
text-rendering: optimizelegibility;
}
th {
text-align: left;
@tjrobinson
tjrobinson / nuget-usage.ps1
Created August 2, 2013 08:45
Find NuGet packages across multiple solutions
$packagesInUse = @()
[xml] $nugetConfig = [xml](Get-Content nuget.config)
[System.Xml.XmlElement] $nugetConfigRoot = $nugetConfig.get_DocumentElement()
$repositoryPath = $nugetConfigRoot.SelectSingleNode("repositoryPath").InnerText
Write-Host "repositoryPath:" $repositoryPath
[xml] $repositories = [xml](Get-Content $repositoryPath\repositories.config)
[System.Xml.XmlElement] $repositoriesRoot = $repositories.get_DocumentElement()
input {
tcp {
type => "eventlog"
host => "10.1.1.2"
port => 3515
format => 'json'
}
}
@tjrobinson
tjrobinson / StandardNoStopWordsAnalyser.cs
Last active August 29, 2015 14:01
Upgrade from Lucene.NET 3 to Lucene.NET 4.0
public class StandardNoStopWordsAnalyser : StandardAnalyzer
{
public StandardNoStopWordsAnalyser() : base(Version.LUCENE_29, new HashSet<string>()) { }
}
@tjrobinson
tjrobinson / Web.config
Created July 2, 2014 12:57
Defining a redirect/rewrite in the Web.config
<?xml version="1.0"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Index Request" enabled="true" stopProcessing="true">
<match url="^$"/>
<action type="Rewrite" url="App/app.html" logRewrittenUrl="true"/>
</rule>
</rules>
@tjrobinson
tjrobinson / AcmeUserAccountService.cs
Created August 11, 2014 08:45
MembershipReboot UserAccountService implementation with custom username validation
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using BrockAllen.MembershipReboot;
namespace Acme.Users.MembershipReboot
{
public class AcmeUserAccountService<TAccount> : UserAccountService<TAccount>
@tjrobinson
tjrobinson / gist:0ad6c790e90d7a385eb1
Last active July 12, 2018 02:55
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;
Split-Path -parent $dte.Solution.FileName | cd
New-Item -ItemType Directory -Force -Path ".\licenses"
@( Get-Project -All |
? { $_.ProjectName } |
% { Get-Package -ProjectName $_.ProjectName } ) |
Sort -Unique |
% { $pkg = $_ ; Try { (New-Object System.Net.WebClient).DownloadFile($pkg.LicenseUrl, (Join-Path (pwd) 'licenses\') + $pkg.Id + ".html") } Catch [system.exception] { Write-Host "Could not download license for $pkg" } }