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 ($) { | |
// Make ASP's unobtrusive validation compatible with Bootstrap 5 styling. See this for more details: https://stackoverflow.com/a/19006517/576153 | |
$.validator.setDefaults({ | |
errorElement: "span", | |
errorClass: "invalid-feedback", | |
highlight: function (element, errorClass, validClass) { | |
// Only validation controls | |
if (!$(element).hasClass('novalidation')) { | |
$(element).closest('.form-control').removeClass('is-valid').addClass('is-invalid'); | |
} |
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 Microsoft.AspNetCore.Mvc.ViewEngines; | |
using Microsoft.Extensions.DependencyInjection; | |
namespace Microsoft.AspNetCore.Mvc | |
{ | |
/// <summary> | |
/// Controller extensions | |
/// </summary> | |
public static class ControllerExtensions | |
{ |
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
<h1>Angular 2 Recursive List</h1> | |
<ul> | |
<ng-template #recursiveList let-list> | |
<li *ngFor="let item of list"> | |
{{item.title}} | |
<ul *ngIf="item.children.length > 0"> | |
<ng-container *ngTemplateOutlet="recursiveList; context:{ $implicit: item.children }"></ng-container> | |
</ul> | |
</li> | |
</ng-template> |
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; | |
using System.Web.Mvc; | |
using System.Web.Routing; | |
namespace MyNamespace | |
{ | |
public class RouteConfig |
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.Runtime.CompilerServices; | |
using System.Security.Cryptography; | |
public class PasswordUtility | |
{ | |
// Original Version Copyright: | |
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. | |
// Original License: http://www.apache.org/licenses/LICENSE-2.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
// JS array equivalents to C# LINQ methods - by Dan B. | |
// First: This version using older JavaScript notation for universal browser support (scroll down for ES6 version): | |
// Here's a simple array of "person" objects | |
var people = [ | |
{ name: "John", age: 20 }, | |
{ name: "Mary", age: 35 }, | |
{ name: "Arthur", age: 78 }, | |
{ name: "Mike", age: 27 }, |
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 string GetVirtualPath(VirtualPathContext context) | |
{ | |
foreach (var matcherParameter in _matcher.Template.Parameters) | |
{ | |
context.Values.Remove(matcherParameter.Name); // make sure none of the domain-placeholders are appended as query string parameters | |
} | |
return _innerRoute.GetVirtualPath(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
{ | |
"vars": { | |
"@gray-darker": "lighten(#000, 13.5%)", | |
"@gray-dark": "lighten(#000, 20%)", | |
"@gray": "lighten(#000, 33.5%)", | |
"@gray-light": "lighten(#000, 46.7%)", | |
"@gray-lighter": "lighten(#000, 93.5%)", | |
"@brand-primary": "#428bca", | |
"@brand-success": "#5cb85c", | |
"@brand-info": "#5bc0de", |
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
<?xml version="1.0" encoding="utf-8"?> | |
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> | |
<system.web> | |
<compilation xdt:Transform="RemoveAttributes(debug)" /> | |
<httpCookies httpOnlyCookies="true" requireSSL="true" lockItem="true" xdt:Transform="Replace" /> | |
<authentication mode="Forms"> | |
<forms loginUrl="~/Logon/LogOn" timeout="2880" requireSSL="true" xdt:Transform="Replace"/> | |
</authentication> | |
</system.web> |
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
<?php | |
/** | |
* Database Connection class. | |
* | |
* Example: | |
* $dbi = DBConnection::getInstance(); | |
* $q = "SELECT * FROM Users WHERE Username=?"; | |
* $a = array($_GET['username']); | |
* $users = $dbi->query($q, $a); |
NewerOlder