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
| let set = new Set([3, 5, true, 'This is a string, obviously.']); | |
| for (let item of set.values()) { | |
| console.log(item); | |
| } |
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
| services.AddMvcCore(options => | |
| { | |
| options.Filters.Add(typeof(ValidateModelFilter)); | |
| }) |
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 ValidateModelFilter : ActionFilterAttribute | |
| { | |
| public override void OnActionExecuting(ActionExecutingContext context) | |
| { | |
| if (!context.ModelState.IsValid) | |
| { | |
| context.Result = new BadRequestObjectResult(context.ModelState); | |
| } | |
| } | |
| } |
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
| if (!ModelState.IsValid) | |
| { | |
| return BadRequest(ModelState); | |
| } |
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
| var mockMyRepository = new Mock<IMyRepository>(); | |
| mockMyRepository.Setup(repo => repo.GetData("john")) | |
| .Returns(Task.FromResult("Corrrect")); | |
| mockMyRepository.Setup(repo => repo.GetData("codingblast")) | |
| .Returns(Task.FromResult("Yeah!")); | |
| var authService = BuildAuthorizationService(services => | |
| { |
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
| private IAuthorizationService BuildAuthorizationService(Action<IServiceCollection> setupServices = null) | |
| { | |
| var services = new ServiceCollection(); | |
| services.AddAuthorization(); | |
| services.AddLogging(); | |
| services.AddOptions(); | |
| setupServices?.Invoke(services); | |
| return services.BuildServiceProvider().GetRequiredService<IAuthorizationService>(); | |
| } |
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
| a.active { | |
| color: blue; | |
| } |
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
| <NavLink activeClassName="active" to="/">Home</NavLink> |
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
| <Link replace={true} to="/children">Children</Link> |
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
| <Link | |
| to={{ | |
| pathname: '/logs', | |
| search: '?filter=active', | |
| state: { fromNavBar: true } | |
| }} | |
| > | |
| Logs | |
| </Link>; |