This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
* This is a copy of the shim provided by MDN | |
* https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach | |
*/ | |
(function () { | |
// Production steps of ECMA-262, Edition 5, 15.4.4.18 | |
// Reference: http://es5.github.io/#x15.4.4.18 | |
if (!Array.prototype.forEach) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
/// <summary> | |
/// Represents a line (using decimal values) on a drawing pane. Can be used to simply represent two points. | |
/// </summary> | |
public class LineF { | |
public System.Drawing.PointF PointOne { get; set; } | |
public System.Drawing.PointF PointTwo { get; set; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Text; | |
/// <summary> | |
/// A class for encrypting and decrypting a string into base64 format which makes it safe for transfer | |
/// between applications. | |
/// | |
/// Reference: | |
/// Based upon the javascript implementation of xxtea by: Chris Veness | |
/// www.movable-type.co.uk/tea-block.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Diagnostics; | |
using Dia = System.Diagnostics; | |
/// <summary> | |
/// Simple functions for working with processes | |
/// </summary> | |
public static class Process { | |
/// <summary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Runtime.InteropServices; | |
using System.Security.Principal; | |
/// <summary> | |
/// IDisposible wrapper for running code as a different user. Designed to be using in an using statement. | |
/// | |
/// An adaptation of a sample from Msdn. | |
/// </summary> | |
public class Impersonate : IDisposable { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Offers simple static functions for exporting and importing an object to xml from and into a file | |
/// </summary> | |
public static class Objects { | |
/// <summary> | |
/// Exports passed object to the file stated using a DataContractSerialiser to convert it into XML. REQUIRED A serializable attribute type recongnised by DataContractSerializer | |
/// E.g. Serializable, XmlSerializable, and DataContract | |
/// </summary> | |
/// <param name="filename">The file to export to</param> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; (function () { | |
if (!Object.keys) { | |
Object.keys = function (o) { | |
if (o !== Object(o)) { | |
throw new TypeError('Object.keys called on a non-object'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// To be used with CorsMiddleware <code>app.UseCors()</code> where origins are restricted to the parameters passed in. | |
/// </summary> | |
public partial class CorsOptionsExt { | |
public static CorsOptions AllowOrigins(params string[] origins) { | |
return new CorsOptions() { | |
PolicyProvider = new CorsPolicyProvider() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Required for code highlightpack | |
// Production steps of ECMA-262, Edition 5, 15.4.4.19 | |
// Reference: http://es5.github.io/#x15.4.4.19 | |
if (!Array.prototype.map) { | |
Array.prototype.map = function (callback, thisArg) { | |
var T, A, k; | |
if (this == null) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Production steps of ECMA-262, Edition 5, 15.4.4.21 | |
// Reference: http://es5.github.io/#x15.4.4.21 | |
if (!Array.prototype.reduce) { | |
Array.prototype.reduce = function(callback /*, initialValue*/) { | |
'use strict'; | |
if (this == null) { | |
throw new TypeError('Array.prototype.reduce called on null or undefined'); | |
} | |
if (typeof callback !== 'function') { | |
throw new TypeError(callback + ' is not a function'); |