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 class CryptographyExtensions | |
{ | |
/// <summary> | |
/// Calculates the MD5 hash for the given string. | |
/// </summary> | |
/// <returns>A 32 char long MD5 hash.</returns> | |
public static string GetHashMd5(this string input) | |
{ | |
return ComputeHash(input, new MD5CryptoServiceProvider()); | |
} |
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
@{ | |
Func<ModelMetadata, bool> shouldShow = metadata => | |
{ | |
return metadata.ShowForEdit | |
//&& metadata.ModelType != typeof(System.Data.EntityState) | |
&& !metadata.IsComplexType | |
&& !ViewData.TemplateInfo.Visited(metadata); | |
}; | |
} | |
@if (ViewData.TemplateInfo.TemplateDepth > 1) |
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; | |
using System.Linq; | |
using System.Web.Http.Dependencies; | |
using StructureMap; | |
public class StructureMapResolver : IDependencyScope, IDependencyResolver | |
{ | |
private readonly IContainer _container; | |
private readonly bool _isContainerOwner; |
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 class StructureMapNancyBootstrapper : StructureMapNancyBootstrapperBase | |
{ | |
public StructureMapNancyBootstrapper() : base(typeof(MyModule).Assembly) | |
{ | |
} | |
protected override IContainer GetApplicationContainer() | |
{ | |
return new Container(); | |
} |
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
choco install notepad2-mod | |
choco install conemu | |
choco install 7zip | |
choco install googlechrome | |
choco install kdiff3 | |
choco install gitextensions | |
choco install git-credential-winstore | |
choco install nodejs | |
choco install visualstudiocode |
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 Microsoft.AspNet.Builder | |
{ | |
public static class MediatRExtensions | |
{ | |
public static IServiceCollection AddMediatR(this IServiceCollection services, params Assembly[] handlerAssemblies) | |
{ | |
services.AddTransient<IMediator>(x => new Mediator(x.GetService<SingleInstanceFactory>(), x.GetService<MultiInstanceFactory>())); | |
services.AddTransient<SingleInstanceFactory>(x => t => x.GetRequiredService(t)); | |
services.AddTransient<MultiInstanceFactory>(x => t => x.GetServices(t)); |
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
:: The following variables are required: | |
SET AZDEPLOY_SOURCE=C:\Apps\myapp\dist | |
SET AZDEPLOY_APP=myapp | |
SET AZDEPLOY_PASSWORD=mypassword | |
:: The password can be extracted from the publish settings you download from the Azure portal | |
msdeploy.exe ^ | |
-verb:sync ^ | |
-source:contentPath="%AZDEPLOY_SOURCE%" ^ |
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; | |
namespace Microsoft.AspNet.Builder | |
{ | |
public static class DomainEnforcer | |
{ | |
public static IApplicationBuilder UseDomainEnforcer(this IApplicationBuilder app, string domainToEnforce) | |
{ | |
if (string.IsNullOrEmpty(domainToEnforce)) | |
throw new ArgumentNullException(nameof(domainToEnforce)); |
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; | |
namespace Microsoft.AspNet.Builder | |
{ | |
public static class HttpsEnforcer | |
{ | |
public static IApplicationBuilder UseHttpsEnforcer(this IApplicationBuilder app) | |
{ | |
Func<RequestDelegate, RequestDelegate> middleware = next => async context => | |
{ |
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.Diagnostics; | |
using Microsoft.Extensions.Logging; | |
namespace Microsoft.AspNetCore.Builder | |
{ | |
public static class SimpleLogger | |
{ | |
const string LOG_NAME = "MyProject.SimpleLogger"; | |
const string LOG_FORMAT = "{0} | {1}ms | {2} | {3} {4}"; |
OlderNewer