Skip to content

Instantly share code, notes, and snippets.

View mxmissile's full-sized avatar
🎯
Focusing

Travis mxmissile

🎯
Focusing
View GitHub Profile
@mxmissile
mxmissile / test.razor
Created March 20, 2024 14:21
vertical table?
@if (_data != null)
{
var dates = _data.Select(x => x.Date).Distinct();
<table>
<tr>
@foreach (var date in dates)
{
<th>@date.ToShortDateString()</th>
@mxmissile
mxmissile / test.blazor
Created March 20, 2024 14:20
Vertical Table?
@if (_data != null)
{
var dates = _data.Select(x => x.Date).Distinct();
<table>
<tr>
@foreach (var date in dates)
{
<th>@date.ToShortDateString()</th>
}
@mxmissile
mxmissile / Program.cs
Last active March 15, 2024 14:32
Before With ProblemDetails
var builder = WebApplication.CreateBuilder(args);
builder.Host.UseWolverine();
builder.Services.AddHttpContextAccessor();
var app = builder.Build();
app.MapWolverineEndpoints();
[TestClass]
public class WolverineTests
{
[TestMethod]
public async Task cascade_test()
{
using var host = await Host.CreateDefaultBuilder()
.UseWolverine((context, opts) => { })
.StartAsync();
@mxmissile
mxmissile / program.cs
Created June 21, 2022 19:37
api auth
builder.Services.Configure<JwtBearerOptions>(options =>
{
options.Events.OnChallenge += OnChallenge;
});
builder.Services.AddAuthentication().AddMicrosoftIdentityWebApi(builder.Configuration);
async Task OnChallenge(JwtBearerChallengeContext context)
{
public override async Task<Account> CreateAsync (Account entity, CancellationToken token)
{
var context = new Context();
entity.CreateDate = DateTime.Now;
entity.LastUpdated = DateTime.Now;
if (entity.ParentId == 0) entity.ParentId = 1;
context.Accounts.Add(entity);
await context.SaveChangesAsync();
@mxmissile
mxmissile / ef
Last active November 5, 2021 22:19
public dynamic CheckLoginCredentials(string UserName, string Password)
{
return context.Agents
.Where(x => x.LoginName == UserName && x.LoginPassword == Password)
.Select(x => new {
x.LoginName,
x.LoginPassword
})
.FirstOrDefault();
}
public class BrianAssessment
{
public void show_merged_array_ascending_linq()
{
// arrange
var array1 = new[] {1, 3, 5, 8};
var array2 = new[] {0, 3, 3, 6, 9};
// act
var ordered = array1.Concat(array2).OrderBy(x => x);
@mxmissile
mxmissile / api test
Created July 14, 2021 17:39
api test
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.UserAgent.ParseAdd("Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0");
var result = await client.GetStringAsync("http://api.db-ip.com/v2/free/1.10.16.5");
}
@using System.Reflection
@using System.Linq.Expressions;
@using System.ComponentModel
@using System.ComponentModel.DataAnnotations
@typeparam T
<label for="@control">@label</label>
@code {