Skip to content

Instantly share code, notes, and snippets.

@iwannabebot
iwannabebot / UpdateLayout.cshtml
Created September 10, 2018 13:33
Include the Material Lite JavaScript file in _Layout page of your application.
<script defer src="https://code.getmdl.io/1.1.1/material.min.js"></script>
@iwannabebot
iwannabebot / UpdateLayout.cshtml
Created September 10, 2018 13:30
To apply material theme in your application, you need to add the following code in _Layout.cshtml
// If using tag helpers
<c1-styles theme="material" />
// If using html helpers
@Html.C1().Styles().Theme("material")
@iwannabebot
iwannabebot / SwaggerUIOAuth2HeaderStartup.cs
Last active May 13, 2018 08:13
Add Bearer token in header of a Swagger request
public void ConfigureServices(IServiceCollection services)
{
services
.AddSwaggerGen(c =>
{
c.OperationFilter<AddAuthorizationHeaderParameterOperationFilter>();
});
}
/// <summary>
@iwannabebot
iwannabebot / SwaggerUIOAuth2MiddlewarwStartup.cs
Last active May 13, 2018 08:01
Add OAuth2/OpenID compatible middleware to Swagger
public void ConfigureServices(IServiceCollection services)
{
// Other settings
services
.AddSwaggerGen(c =>
{
// Other settings
c.AddSecurityDefinition("oauth2", new OAuth2Scheme
{
Type = "oauth2",
var gist = function(userName, gistId){
return 'https://gist.github.com/' + userName + '/' + gistId + '.js';
}