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 class TcpPort | |
{ | |
public static int NextFreePort() | |
{ | |
var l = new TcpListener(IPAddress.Loopback, 0); | |
try | |
{ | |
l.Start(); | |
return ((IPEndPoint)l.LocalEndpoint).Port; |
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 class Deserialize | |
{ | |
public static TResponse Deserialize<TResponse>(string xmlString) | |
{ | |
var serializer = new XmlSerializer(typeof(TResponse)); | |
using (var stringReader = new StringReader(xmlString)) | |
{ | |
return (TResponse)serializer.Deserialize(stringReader); | |
} | |
} |
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
Roman numerals | |
-------------- | |
http://en.wikipedia.org/wiki/Roman_numerals | |
Reading Roman numerals | |
---------------------- | |
Based on seven symbols | |
I = 1 |
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
module Constants = | |
[<Literal>] | |
let ImportDataFileUrl = "Data.csv" | |
let YouTrackUrl = "http://LocalHost:8082" | |
let YouTrackAdminUserName = "root" | |
let YouTrackAdminPassword = "password" | |
let YouTrackProjectID = "PROJ" | |
#r "FSharp.Data.1.1.10/lib/net40/FSharp.Data.dll" | |
#r "RestSharp.104.4.0/lib/net4/RestSharp.dll" |
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 RelayCommand<T> : ICommand | |
{ | |
private readonly Predicate<T> canExecute; | |
private readonly Action<T> execute; | |
public RelayCommand(Action<T> action) | |
: this(x => true, action) | |
{ | |
execute = action; | |
} |
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
static class UriManager | |
{ | |
private static readonly IDictionary<string, Uri> Uris = new Dictionary<string, Uri>(); | |
public static Uri GetUriForService<TService>() | |
{ | |
return GetUri(typeof (TService).Name); | |
} | |
public static Uri GetUri(string serviceName) |
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.Text; | |
using RabbitMQ.Client; | |
namespace Publisher | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ |
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 TValue Value<TValue>(string value, TValue defaultValue = default(TValue)) | |
{ | |
if (string.IsNullOrEmpty(value)) return defaultValue; | |
var converter = TypeDescriptor.GetConverter(typeof (TValue)); | |
return (TValue) converter.ConvertFrom(value); | |
} |
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
Assembly assembly = Assembly.GetExecutingAssembly(); | |
FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location); | |
string version = fvi.FileVersion; |
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
class HttpApiGuidlinesMiddleware : OwinMiddleware | |
{ | |
public HttpApiGuidlinesMiddleware(OwinMiddleware next) : base(next) { } | |
public override async Task Invoke(IOwinContext context) | |
{ | |
var isApiCall = context.Request.Path.StartsWithSegments(new PathString("/api")); | |
Stream originalStream = null; | |
Stream responseBuffer = null; |
OlderNewer