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 TestOutputHelperTextWriterAdapter : TextWriter | |
{ | |
private readonly ITestOutputHelper output; | |
private string currentLine = ""; | |
public TestOutputHelperTextWriterAdapter(ITestOutputHelper output) | |
{ | |
this.output = output; | |
} |
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 M | |
{ | |
public static int[] DigitsOf(int value) | |
{ | |
var numbers = new List<int>(); | |
for (; value > 0; value /= 10) | |
{ | |
numbers.Add(value % 10); | |
} | |
return numbers.ToArray(); |
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
import React, { Component } from 'react'; | |
import './App.css'; | |
class App extends Component { | |
render() { | |
const unfilteredData = [ | |
{ category: "Sporting Goods", price: "$49.99", stocked: true, name: "Football" }, | |
{ category: "Sporting Goods", price: "$9.99", stocked: true, name: "Baseball" }, | |
{ category: "Sporting Goods", price: "$29.99", stocked: false, name: "Basketball" }, |
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
from microbit import * | |
from random import randint | |
SCENE_WIDTH = 4 | |
INITIAL_DELAY = 500 | |
POSSIBLE_ROADSIDE_ROWS = [ | |
[False, False, True, True, True, ], | |
[True, False, False, True, True, ], | |
[True, True, False, False, True, ], |
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
/* | |
When IdentityServer4 returns role in access-token JSON the type of the "role" member value differs depending on how many roles are present. Two cases: | |
1) Single role - the value is a string, e.g. "role": "patient". | |
2) Multiple roles - the value is an array-of-string, e.g. "role": ["patient", "agent"] | |
The AspNetCore framework on the client side does not like the second case, and it assumes a string, giving an error saying that it can't cast from Newtonsoft.Json.Linq.JArray to Newtonsoft.Json.Linq.JToken. | |
You can work around this by checking the type of the role JSON in OpenIdConnectOptions. | |
*/ |
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 DynamicOrganizationRoleClaimsFactory : UserClaimsPrincipalFactory<ApplicationUser> | |
{ | |
private readonly ApplicationDbContext dbContext; | |
public DynamicOrganizationRoleClaimsFactory(UserManager<ApplicationUser> userManager, | |
IOptions<IdentityOptions> optionsAccessor, ApplicationDbContext dbContext) | |
: base(userManager, optionsAccessor) | |
{ | |
this.dbContext = dbContext; | |
} |
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
namespace Iso { | |
function lface(ctx: CanvasRenderingContext2D, width: number, height: number) { | |
ctx.beginPath(); | |
ctx.moveTo(0, 0); | |
ctx.lineTo(width, width / 2); | |
ctx.lineTo(width, height + width / 2); | |
ctx.lineTo(0, height); | |
ctx.closePath(); |