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 CustomRequireHttpsFilter : RequireHttpsAttribute | |
{ | |
protected override void HandleNonHttpsRequest(AuthorizationContext filterContext) | |
{ | |
// The base only redirects GET, but we added HEAD as well. This avoids exceptions for bots crawling using HEAD. | |
// The other requests will throw an exception to ensure the correct verbs are used. | |
// We fall back to the base method as the mvc exceptions are marked as internal. | |
if (!String.Equals(filterContext.HttpContext.Request.HttpMethod, "GET", StringComparison.OrdinalIgnoreCase) | |
&& !String.Equals(filterContext.HttpContext.Request.HttpMethod, "HEAD", StringComparison.OrdinalIgnoreCase)) |
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 SubdomainRoute : RouteBase | |
{ | |
public override RouteData GetRouteData(HttpContextBase httpContext) | |
{ | |
if (httpContext.Request == null || httpContext.Request.Url == null) | |
{ | |
return null; | |
} | |
var host = httpContext.Request.Url.Host; |
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
; The below line is for debugging key presses in the key history. | |
; #InstallKeybdHook | |
; Turn my useless right alt key into a rad delete key | |
RAlt::Delete | |
; Capture the custom remapped playback keys from the mac keyboard remapper | |
<+<^F7::Send,{Media_Prev} | |
<+<^F8::Send,{Media_Play_Pause} | |
<+<^F9::Send,{Media_Next} |
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
.directive('bootstrapSwitch', [ | |
function() { | |
return { | |
restrict: 'A', | |
require: '?ngModel', | |
link: function(scope, element, attrs, ngModel) { | |
element.bootstrapSwitch(); | |
element.on('switchChange.bootstrapSwitch', function(event, state) { | |
if (ngModel) { |
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
protected ActionResult JsonFormResponse(JsonRequestBehavior jsonRequestBehaviour = JsonRequestBehavior.DenyGet) | |
{ | |
if (ModelState.IsValid) | |
{ | |
return new HttpStatusCodeResult(200); | |
} | |
var errorList = new List<JsonValidationError>(); | |
foreach (var key in ModelState.Keys) | |
{ |
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 WordDocumentAttribute : ActionFilterAttribute | |
{ | |
public string DefaultFilename { get; set; } | |
public override void OnActionExecuted(ActionExecutedContext filterContext) | |
{ | |
var result = filterContext.Result as ViewResult; | |
if (result != null) | |
result.MasterName = "~/Views/Shared/_LayoutWord.cshtml"; |
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 HttpsWebServiceHostFactory : WebServiceHostFactory | |
{ | |
protected override System.ServiceModel.ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses) | |
{ | |
WebServiceHost host = new WebServiceHost(serviceType, baseAddresses); | |
foreach (Uri baseAddress in baseAddresses) | |
{ | |
WebHttpBinding binding = CreateRestBinding(baseAddress); | |
ServiceEndpoint endpoint = host.AddServiceEndpoint(serviceType.GetInterfaces()[0], binding, baseAddress); |
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 HttpsServiceHostFactory : ServiceHostFactory | |
{ | |
protected override System.ServiceModel.ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses) | |
{ | |
ServiceHost host = new ServiceHost(serviceType, baseAddresses); | |
foreach (Uri baseAddress in baseAddresses) | |
{ | |
BasicHttpBinding binding = CreateSoapBinding(baseAddress); |