This file contains hidden or 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
// Setup CSRF safety for AJAX: | |
$.ajaxPrefilter(function(options, originalOptions, jqXHR) { | |
if (options.type.toUpperCase() === "POST") { | |
// We need to add the verificationToken to all POSTs | |
var token = $("input[name^=__RequestVerificationToken]").first(); | |
if (!token.length) return; | |
var tokenName = token.attr("name"); | |
This file contains hidden or 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
var input = "a, b, (c, d), (e, (f, g), h), 'i, j, (k, l), m', 'n, \"o, 'p', q\", r'"; | |
var result = SplitBalanced(input, ","); | |
// Results: | |
["a", | |
" b", | |
" (c, d)", | |
" (e, (f, g), h)", | |
" 'i, j, (k, l), m'", | |
" 'n \"o, 'p', q\", r'"]; |
This file contains hidden or 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 class CustomComparer<TSource, TCompareType> : IEqualityComparer<TSource> where TSource : class | |
{ | |
private readonly Func<TSource, TCompareType> getComparisonObject; | |
public CustomComparer(Func<TSource,TCompareType> getComparisonObject) | |
{ | |
if (getComparisonObject == null) throw new ArgumentNullException("getComparisonObject"); | |
this.getComparisonObject = getComparisonObject; | |
} | |
/// <summary> |
NewerOlder