Skip to content

Instantly share code, notes, and snippets.

View MatthewBarker's full-sized avatar

Matt Barker MatthewBarker

  • Cheadle, Cheshire, England
View GitHub Profile
@MatthewBarker
MatthewBarker / codeMap.xml
Last active February 18, 2021 00:24 — forked from heybignick/.block
D3.js v4 Force Directed Graph with Labels
<?xml version="1.0" encoding="utf-8"?>
<DirectedGraph DataVirtualized="True" Layout="Sugiyama" ZoomLevel="-1" xmlns="http://schemas.microsoft.com/vs/2009/dgml">
<Nodes>
<Node Id="(@21 @342 Type=WikiMemory @380)" Category="CodeSchema_Method" Bounds="-81.4181795104529,-343.557109835615,103.386666666667,25.96" CodeSchemaProperty_IsConstructor="True" CodeSchemaProperty_IsPublic="True" CodeSchemaProperty_IsSpecialName="True" DelayedCrossGroupLinksState="Fetched" Label="WikiMemory" />
<Node Id="@10" Category="CodeSchema_Assembly" Bounds="0,0,213.706666666667,25" CodeSchemaProperty_IsExternal="True" CodeSchemaProperty_StrongName="System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DelayedChildNodesState="NotFetched" FilePath="C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\3.1.0\ref\netcoreapp3.1\System.ServiceModel.Web.dll" Group="Collapsed" Label="System.ServiceModel.Web.dll">
<Category Ref="FileSystem.Category.FileOfType.dll" />
</Node>
<Node
@MatthewBarker
MatthewBarker / codeMap.xml
Last active February 14, 2021 22:03 — forked from mbostock/.block
Blocks Graph
<?xml version="1.0" encoding="utf-8"?>
<DirectedGraph DataVirtualized="True" Layout="Sugiyama" ZoomLevel="-1" xmlns="http://schemas.microsoft.com/vs/2009/dgml">
<Nodes>
<Node Id="(@21 @342 Type=WikiMemory @380)" Category="CodeSchema_Method" Bounds="-81.4181795104529,-343.557109835615,103.386666666667,25.96" CodeSchemaProperty_IsConstructor="True" CodeSchemaProperty_IsPublic="True" CodeSchemaProperty_IsSpecialName="True" DelayedCrossGroupLinksState="Fetched" Label="WikiMemory" />
<Node Id="@10" Category="CodeSchema_Assembly" Bounds="0,0,213.706666666667,25" CodeSchemaProperty_IsExternal="True" CodeSchemaProperty_StrongName="System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DelayedChildNodesState="NotFetched" FilePath="C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\3.1.0\ref\netcoreapp3.1\System.ServiceModel.Web.dll" Group="Collapsed" Label="System.ServiceModel.Web.dll">
<Category Ref="FileSystem.Category.FileOfType.dll" />
</Node>
<Node
@MatthewBarker
MatthewBarker / index.html
Created February 13, 2021 00:03 — forked from lgrammel/index.html
D3.xml Example
<!DOCTYPE html>
<html>
<head>
<title>D3.xml Example</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.v2.js"></script>
<style type="text/css">
.chart div {
font: 10px sans-serif;
background-color: steelblue;
text-align: right;
@MatthewBarker
MatthewBarker / parse-rss-pub-date.js
Created January 20, 2017 09:37
Parse RSS pubDate using moment.js
// RSS feeds are supposed to have a standardised date format, as shown in the RSS 2.0 specification:
// All date-times in RSS conform to the Date and Time Specification of RFC 822,
// with the exception that the year may be expressed with two characters or four characters (four preferred).
// Example: Sat, 07 Sep 2002 0:00:01 GMT
var formats = ['ddd, DD MMM YYYY HH:mm:ss ZZ', 'ddd, DD MMM YY HH:mm:ss ZZ'];
var pubDate = moment(item.querySelector('pubDate').textContent, formats);
@MatthewBarker
MatthewBarker / style.css
Last active December 23, 2016 10:23
Risk
svg {
background-color: #eeeeee;
}
text {
font-size: 50%;
}
.connector path {
fill: none;
ko.bindingHandlers.pathText = {
init: function(element, valueAccessor, allBindings, viewModel, bindingContext) {
var phrase = ko.unwrap(valueAccessor());
var text = document.createElementNS('http://www.w3.org/2000/svg', 'text');
var elementBox = element.getBBox();
//text.textContent = value;
phrase.split(' ').forEach(function(word){
var span = document.createElementNS('http://www.w3.org/2000/svg', 'tspan');
{
"connectors": [
{ "path": "m317.503479,134.444931l13,-19" },
{ "path": "m330.503479,115.444931l23.25,13.5" },
{ "path": "m353.753479,128.944931l-0.25,34.25" },
{ "path": "m353.503479,163.194931l-36.25,-28.75" },
{ "path": "m317.503479,134.444931l36.25,-5.25" },
{ "path": "m322.253479,196.569931l-7.5,-12.5" },
{ "path": "m394.860474,252.758041l1.414246,18.207962" },
{ "path": "m459.56073,313.038879l-8.131683,12.551147" },
@MatthewBarker
MatthewBarker / trim.js
Created November 21, 2016 12:19
Trim poly-fill for IE8
if (!String.prototype.trim) {
String.prototype.trim = function () {
return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
};
}
@MatthewBarker
MatthewBarker / AutomapServiceBehavior.cs
Created March 31, 2016 10:55
Automap service behaviour
namespace WcfService
{
using System.Collections.ObjectModel;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
using Logic.Mappers;
/// <summary>
/// Registers AutoMapper for the calls to business logic methods.
@MatthewBarker
MatthewBarker / DataContext.tt
Last active March 30, 2016 15:16
DataContext template using IQueryable
<#@ template language="C#" debug="false" hostspecific="true"#>
<#@ include file="EF.Utility.CS.ttinclude"#>
<#@ output extension=".cs"#>
<#
var loader = new MetadataLoader(this);
var region = new CodeRegion(this);
var inputFile = @"TradingPartner.edmx";
var itemCollection = loader.CreateEdmItemCollection(inputFile);
var container = itemCollection.GetItems<EntityContainer>().FirstOrDefault();
var fileManager = EntityFrameworkTemplateFileManager.Create(this);