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
//Stolen from @mkristensen | |
//Use to bust static content like .js and .css when they changed. | |
using System.IO; | |
using System.Web; | |
using System.Web.Caching; | |
using System.Web.Hosting; | |
namespace CHANGE_YOUR_NAMESPACE_HERE | |
{ | |
public class Fingerprint |
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
namespace __NAMESPACE__ | |
{ | |
using System; | |
using System.IO; | |
using System.Runtime.Serialization.Formatters.Binary; | |
public static class ObjectCopier | |
{ | |
/// <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
namespace __NAMESPACE__ | |
{ | |
using System.Linq; | |
using System.Collections.Generic; | |
/// <summary> | |
/// Check if expected list items are all in master list | |
/// </summary> | |
/// <typeparam name="T">Generic Type</typeparam> |
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
namespace __NAMESPACE__ | |
{ | |
using System.IO; | |
public static class StreamExtension | |
{ | |
public static byte[] ToByteArray(this Stream input) | |
{ | |
using (var memStream = new MemoryStream()) | |
{ |
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
namespace __NAMESPACE__ | |
{ | |
using System; | |
using System.IO; | |
using System.Xml; | |
using System.Text; | |
using System.Runtime.Serialization.Formatters.Binary; | |
using Newtonsoft.Json; | |
using JsonSerializer = ServiceStack.Text.JsonSerializer; | |
using XmlSerializer = System.Xml.Serialization.XmlSerializer; |
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
namespace __NAMESPACE__ | |
{ | |
using System.Text; | |
using System.Security.Cryptography; | |
using System.Text.RegularExpressions; | |
public static class StringExtension | |
{ | |
public static string StripInvalidUnicodeCharacters(this string str) | |
{ |
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
public static string BinaryToHex(byte[] data) | |
{ | |
if (data == null) | |
{ | |
return null; | |
} | |
var array = new char[checked(data.Length*2)]; | |
for (var i = 0; i < data.Length; i++) | |
{ |
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
//Forked from kristopherjohnson/SHA1Util.cs gist | |
using System.Security.Cryptography; | |
using System.Text; | |
namespace Snippets | |
{ | |
public static class SHA1Util | |
{ | |
/// <summary> | |
/// Compute hash for string encoded as UTF8 |
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
//mimetypes: http://www.sitepoint.com/web-foundations/mime-types-complete-list/ | |
//https://technet.microsoft.com/en-us/library/ee309278(office.12).aspx | |
public static class FileUtil | |
{ | |
public static string DetectFileType(string filename, Stream fileStream) | |
{ | |
var ext = Path.GetExtension(filename); | |
if (string.IsNullOrEmpty(ext)) | |
{ |
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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>GistRun</title> | |
<link data-require="[email protected]" data-semver="3.3.6" rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.css" /> | |
<link rel="stylesheet" href="styles.css"> | |
</head> | |
<body> | |
<div class="container" ng-app="app" ng-controller="pageCtrl as page"> |
OlderNewer