Skip to content

Instantly share code, notes, and snippets.

View i-e-b's full-sized avatar
🤔
Thinking

Iain Ballard i-e-b

🤔
Thinking
View GitHub Profile
@i-e-b
i-e-b / importJavascript.csproj
Last active August 29, 2015 13:55
Item group to recursively include *.ts file but not *.d.ts
<ItemGroup>
<Content Include="..\TsPackages\**\*.js" Exclude="..\TsPackages\**\bin\**\*.*">
<Link>Scripts\%(RecursiveDir)%(Filename)%(Extension)</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
@i-e-b
i-e-b / MemoryExhaustionTests.cs
Created February 12, 2014 09:11
Testing behaviour of XmlNode.OuterXml
using System;
using System.IO;
using System.IO.Compression;
using System.Text;
using System.Xml;
using Microsoft.VisualStudio.TestTools.UnitTesting;
[TestClass]
public class MemoryExhaustionTests
{
@i-e-b
i-e-b / resharper8_sigma.DotSettings
Created February 18, 2014 12:53
Resharper 8 DotSettings - Sigma
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/AutoCompleteBasicCompletion/@EntryValue">True</s:Boolean>
<s:Int64 x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/KeywordCompletionMinLength/@EntryValue">3</s:Int64>
<s:String x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/ParenthesesInsertType/@EntryValue">None</s:String>
<s:String x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/TabKeyInsertType/@EntryValue">Insert</s:String>
<s:Boolean x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/AutopopupEnabled/AutopopupEnabled/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/AutopopupEnabled/CSharpAutopopupEnabled/AfterDot/@EntryValue">NoAutop
@i-e-b
i-e-b / projectFile.xml
Last active August 29, 2015 13:56
Including files in Visual Studio project files, where it may be in one of a few places
<!-- Fragment showing conditions for both location and target platform -->
<PropertyGroup>
<InternalPath>..\..\Installers\Binaries</InternalPath>
<ExternalPath>..\..\..\..\..\Installers\Binaries</ExternalPath>
</PropertyGroup>
<ItemGroup>
<WixLibrary Include="Template" Condition=" '$(Platform)' == 'x86' ">
<HintPath Condition="Exists('$(InternalPath)')">$(InternalPath)\x86\Template.wixlib</HintPath>
<HintPath Condition="Exists('$(ExternalPath)')">$(ExternalPath)\x86\Template.wixlib</HintPath>
@i-e-b
i-e-b / FilePermissions.cs
Created March 5, 2014 16:43
Pass directory ACL to child files
using System.IO;
using System.Security.AccessControl;
/// <summary>
/// Tools for changing file permissions
/// </summary>
public static class FilePermissions
{
/// <summary>
/// Try to force all files in a folder to use the folder's ACL permissions
@i-e-b
i-e-b / EnumerableExtensions_DistinctOn.cs
Last active August 29, 2015 13:58
C# LINQ - get a distinct set based on a selector's equality over an enumeration
using System;
using System.Collections.Generic;
using System.Linq;
public static class EnumerableExtensions
{
public static IEnumerable<T> DistinctOn<T, TS>(this IEnumerable<T> src, Func<T, TS> selector)
{
var ge = new GeneralEquality<T,TS>(selector);
return src.Distinct(ge);
@i-e-b
i-e-b / SparseArray.cs
Created June 30, 2014 11:17
Old SparseArray implementation
using System;
using System.Collections;
using System.Collections.Generic;
/// <summary>
/// A sparsey-populated n-dimensional array, based on a hash table.
/// </summary>
public class SparseArray : IList
{
readonly int dimensions;
@i-e-b
i-e-b / Javascript (in)equality graphs
Last active August 29, 2015 14:04
Javascript (in)equality graphs
http://jsfiddle.net/G943v/16/
http://jsfiddle.net/G943v/1/
@i-e-b
i-e-b / docker_local.md
Last active August 29, 2015 14:04
Getting docker to talk to base box under VMWare / Ubuntu 14.04

Make sure all is clean:

This command comes from ( https://coderwall.com/p/ewk0mq ), but both the outer and inner docker calls must be as root. This will stop all docker containers on the machine -- use with caution!

sudo bash
docker stop -t 0 $(docker ps -a -q)
docker rm $(docker ps -a -q)
exit