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 Ninject; | |
| using System; | |
| using System.Web.Mvc; | |
| namespace Factories | |
| { | |
| public class NinjectControllerFactory : DefaultControllerFactory | |
| { | |
| public IKernel Kernel { get; private set; } |
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.IO; | |
| using System.Linq; | |
| using System.Reflection; | |
| using System.Web.Compilation; | |
| //Add to AssemblyInfo [assembly: PreApplicationStartMethod(typeof(ApplicationDynamicDiscovery), "Discover")] | |
| namespace Web | |
| { | |
| public static class ApplicationDynamicDiscovery |
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 NamespaceConstraint : ActionMethodSelectorAttribute | |
| { | |
| public override bool IsValidForRequest(ControllerContext controllerContext, MethodInfo methodInfo) | |
| { | |
| var dataTokenNamespace = (string)controllerContext.RouteData.DataTokens.FirstOrDefault(dt => dt.Key == "Namespace").Value; | |
| var actionNamespace = methodInfo?.DeclaringType?.FullName; | |
| return dataTokenNamespace == actionNamespace; | |
| } | |
| } |
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.Collections.Generic; | |
| using System.Data.Entity; | |
| using System.Linq; | |
| using Moq; | |
| namespace Test.Common.Mock.Repository | |
| { | |
| public abstract class MockBaseRepository<T, TEntity> : Mock<T> | |
| where TEntity : class, IEntity | |
| where T : BaseRepository<TEntity> |
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; | |
| namespace Common.Utility | |
| { | |
| public class PasswordGenerator | |
| { | |
| public static string Create(int length = 8) | |
| { | |
| const string valid = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; |
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 ImageController : Controller | |
| { | |
| private readonly IImageService _imageService; | |
| public ImageController(IImageService imageService) | |
| { | |
| _imageService = imageService; | |
| } | |
| [HttpPost] |
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
| <!-- ASP.NET part: "https://gist.github.com/Mr-Zoidberg/d9be453eb7d8cc7fc787f01dd381db17" --> | |
| <!-- angular module and service are common so not included --> | |
| <style> | |
| .cropArea { | |
| width: 200px; | |
| height: 200px; | |
| margin: 0 auto; | |
| background-color: black; | |
| } | |
| .horizontal-center { |
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
| function dataUrItoBlob(dataUri) { | |
| var binary = atob(dataUri.split(',')[1]); | |
| var mimeString = dataUri.split(',')[0].split(':')[1].split(';')[0]; | |
| var array = []; | |
| for (var i = 0; i < binary.length; i++) { | |
| array.push(binary.charCodeAt(i)); | |
| } | |
| return new Blob([new Uint8Array(array)], { type: mimeString }); | |
| }; |
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
| (function () { | |
| 'use strict'; | |
| var phonePattern = /^\+{0,1}[\d ()-]+$/; | |
| app.directive('phoneNumber', function () { | |
| return { | |
| require: 'ngModel', | |
| link: function (scope, elm, attrs, ctrl) { | |
| ctrl.$validators.phoneNumber = function (modelValue, viewValue) { |
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
| (function () { | |
| 'use strict'; | |
| app.factory('authInterceptorService', authInterceptorService); | |
| authInterceptorService.$inject = ['$q', 'localStorageService', 'constantsService']; | |
| function authInterceptorService ($q, localStorageService, constantsService) { | |
| var authInterceptorServiceFactory = {}; | |
| function request (config) { |