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.Collections.Generic; | |
namespace AlgorithmForce.Searching | |
{ | |
/* | |
* Full implementation: | |
* https://github.com/rvhuang/kmp-algorithm/blob/master/src/AlgorithmForce.Searching/Extensions.cs | |
*/ | |
public static class Extensions |
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 Newtonsoft.Json; | |
using System; | |
using System.IO; | |
using System.Linq; | |
using System.Net; | |
using System.Net.Http; | |
using System.Web.Http; | |
namespace WebApplication1.Controllers | |
{ |
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 StackExchange.Redis; | |
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
namespace ModelWorkshop.Scheduling.Redis | |
{ | |
internal class RedisCollectionEnumerator<TItem> : IEnumerator<TItem> | |
{ | |
#region Fields |
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.Collections; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace GitHub.Gist | |
{ | |
public class ColumnWrapper<T> : IList<T>, IReadOnlyList<T> | |
{ | |
private readonly T[][] array; |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
// https://rvhuang.github.io/livedemo/coinsflipping.html | |
#r "..\Shared\AlgorithmForce.HeuristicSuite.Portable.dll" | |
using System; | |
using System.Collections.Generic; | |
using System.Net; | |
using System.Web.Http; | |
using AlgorithmForce.HeuristicSuite; | |
public static IEnumerable<bool[]> Run(Request req, TraceWriter log) |
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 Swashbuckle.Swagger; | |
using System; | |
using System.Web.Http.Description; | |
namespace UploadingFileFromSwagger.Models | |
{ | |
/* How to use: | |
GlobalConfiguration.Configuration | |
.EnableSwagger(c => | |
{ |
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 Extensions | |
{ | |
public static class PermutationsExtension | |
{ | |
public static IEnumerable<string> GetPermutations(this string str) | |
{ | |
return GetPermutations<string, char>(str, array => new string(array)); | |
} | |
public static IEnumerable<TCollection> GetPermutations<TCollection, TElement>(this TCollection elements, |
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
// Full source code - https://github.com/rvhuang/linq-to-astar/ | |
public static Node<TFactor, TStep> Run<TFactor, TStep>(HeuristicSearchBase<TFactor, TStep> source) | |
{ | |
var open = new List<Node<TFactor, TStep>>(source.ConvertToNodes(source.From, 0)); | |
if (open.Count == 0) | |
return null; | |
open.Sort(source.NodeComparer); |