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 / DataService.cs
Created February 18, 2015 15:54
Server side sorting, paging & filtering from DataTable to Kendo UI Grid
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using Newtonsoft.Json;
/// <summary>
/// Represents the data service.
/// </summary>
public class DataService
@MatthewBarker
MatthewBarker / filter.js
Created March 24, 2015 10:18
Filter polyfill - taken from MDN for use in JSfiddle
if (!Array.prototype.filter) {
Array.prototype.filter = function(fun/*, thisArg*/) {
'use strict';
if (this === void 0 || this === null) {
throw new TypeError();
}
var t = Object(this);
var len = t.length >>> 0;
@MatthewBarker
MatthewBarker / svg2obj.js
Created February 16, 2016 14:54
Converts an SVG to an OBJ (only supports paths and hex colours in the fill attribute)
var fs = require('fs'),
glob = require('glob'),
hex2rgb = require('color-functions/lib/hex2rgb'),
os = require('os'),
svgMesh3d = require('svg-mesh-3d'),
xpath = require('xpath.js'),
DOMParser = require('xmldom').DOMParser;
function simplicialComplexToObj(mesh) {
var result = '';
@MatthewBarker
MatthewBarker / Glow.js
Created July 29, 2015 12:44
Phaser glow filter
/*jslint white: true*/
/*global Phaser*/
/**
* Defines a glow filter for Web GL.
* @module
*/
Phaser.Filter.Glow = function (game) {
'use strict';
@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 / AutomapServiceBehavior.cs
Created February 25, 2015 11:55
AutomapServiceBehavior: This avoids multi threading issues with Automapper in a class library used by WCF. A static MapperConfig class is called by the service behaviour.
namespace ServiceLayer
{
using System;
using System.Collections.ObjectModel;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
using LAI.Data.Controllers.Mappers;
/// <summary>
@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 / 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, '');
};
}