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 PdfFilter : Stream | |
| { | |
| private readonly Stream _oldFilter; | |
| private readonly string _baseUrl; | |
| private readonly MemoryStream _memStream; | |
| public override bool CanSeek | |
| { | |
| get { return false; } | |
| } |
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 Perlin | |
| { | |
| // Original C code derived from | |
| // http://astronomy.swin.edu.au/~pbourke/texture/perlin/perlin.c | |
| // http://astronomy.swin.edu.au/~pbourke/texture/perlin/perlin.h | |
| const int B = 0x100; | |
| const int BM = 0xff; | |
| const int N = 0x1000; | |
| int[] p = new int[B + B + 2]; |
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
| for (int index = 0; Enum.IsDefined(typeof(InteractionTypeEnum), index); index++) // Nice! | |
| yield return new TaskItemType((InteractionTypeEnum)Enum.Parse(typeof(InteractionTypeEnum), index.ToString(CultureInfo.InvariantCulture))) |
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 interface IResponse | |
| { | |
| bool IsSuccess { get; set; } | |
| string ErrorMessage { get; set; } | |
| } | |
| ... | |
| public static Task<T> GetResponseAsync<T>(string url, string method = "POST") where T: IResponse, new() | |
| { | |
| try |
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
| if (!String.prototype.format) { | |
| String.prototype.format = function() { | |
| var args = arguments; | |
| return this.replace(/{(\d+)}/g, function(match, number) { | |
| return typeof args[number] != 'undefined' | |
| ? args[number] | |
| : match | |
| ; | |
| }); |
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
| $.fn.scrollToY = function( target, options, callback ){ | |
| if(typeof options == 'function' && arguments.length == 2){ callback = options; options = target; } | |
| var settings = $.extend({ | |
| scrollTarget : target, | |
| offsetTop : 50, | |
| duration : 500, | |
| easing : 'swing' | |
| }, options); | |
| return this.each(function(){ |
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
| // C# version | |
| public static string AutoElipsis(this string text, int maxLength) | |
| { | |
| if (text == null || text.Length < maxLength) | |
| return text; | |
| return text.Substring(0, maxLength-3) + "..."; | |
| } | |
| // JS version |
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 static IEnumerable<T[]> Split<T>(this T[] array, int blockSize) | |
| { | |
| List<T> list = new List<T>(); | |
| for(int i = 0; i < array.Length; i++) | |
| { | |
| if (i % blockSize == 0) | |
| { | |
| if (list.Count > 0) | |
| yield return list.ToArray(); | |
| list.Clear(); |
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
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Web; | |
| /// <summary> | |
| /// Cross-Origin Request handler. | |
| /// </summary> | |
| public class CorsModule : IHttpModule | |
| { |
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
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Web; | |
| namespace Sample | |
| { | |
| public class CrossOriginRequestInfo | |
| { | |
| public string Origin { get; set; } |