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.Linq; | |
using System.Net; | |
using System.Net.Http; | |
using System.Threading; | |
using System.Threading.Tasks; | |
//Add to Global.asax -- GlobalConfiguration.Configuration.MessageHandlers.Add(new CorsHandler()); | |
namespace Common.Helpers | |
{ | |
public class CorsHandler : DelegatingHandler |
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.Linq; | |
using System.Text.RegularExpressions; | |
namespace Common.Extensions | |
{ | |
public static class StringHelper | |
{ | |
public static string ToUpperFirstChar(this string input) | |
{ | |
if (string.IsNullOrEmpty(input)) |
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.Linq; | |
using System.Web.Mvc; | |
namespace Common.Helpers | |
{ | |
public class AllowCrossDomainJsonAttribute : ActionFilterAttribute | |
{ | |
const string Origin = "Origin"; | |
const string AccessControlAllowOrigin = "Access-Control-Allow-Origin"; | |
public override void OnActionExecuting(ActionExecutingContext filterContext) |
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
(function() { | |
'use strict'; | |
app.factory('authService', authService); | |
authService.$inject = ['localStorageService']; | |
var authentication = { | |
isAuth: false, | |
customerId: 0 |
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
(function () { | |
'use strict'; | |
app.factory('authInterceptorService', authInterceptorService); | |
authInterceptorService.$inject = ['$q', 'localStorageService', 'constantsService']; | |
function authInterceptorService ($q, localStorageService, constantsService) { | |
var authInterceptorServiceFactory = {}; | |
function request (config) { |
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
(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 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 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 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 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"; |
OlderNewer