Skip to content

Instantly share code, notes, and snippets.

@usausa
usausa / TimeAxisCalculator.cs
Last active August 30, 2022 10:48
AxisCalculator
public static class TimeAxisCalculator
{
private static readonly TimeSpan[] CandidateValues =
{
TimeSpan.FromMinutes(1),
TimeSpan.FromMinutes(2),
TimeSpan.FromMinutes(5),
TimeSpan.FromMinutes(10),
TimeSpan.FromMinutes(15),
TimeSpan.FromMinutes(30),
@usausa
usausa / ISectionCallback.cs
Last active June 28, 2022 04:58
Blazor section
public interface ISectionCallback
{
void SetMenu(RenderFragment value);
}
@usausa
usausa / LoadingOverlay.cs
Last active June 20, 2022 07:37
MAUI WindowOverlay
public sealed class LoadingOverlay : WindowOverlay
{
public LoadingOverlay(IWindow window)
: base(window)
{
AddWindowElement(new LoadingElementOverlay());
EnableDrawableTouchHandling = true;
}
private class LoadingElementOverlay : IWindowOverlayElement
@usausa
usausa / App.razor
Last active May 22, 2022 06:37
Blazor router
<CascadingAuthenticationState>
<Router AppAssembly="@typeof(App).Assembly">
<Found Context="routeData">
<ExtendedErrorBoundary @ref="errorBoundary">
<ChildContent>
<ExtendedAuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" NotAuthorizedLayout="@typeof(ErrorLayout)">
<NotAuthorized>
@if (context.User.Identity?.IsAuthenticated != true)
{
<Server.Pages.Login Reload="true" />
<ItemGroup>
<Resource Include="App.ico" />
</ItemGroup>
<ItemGroup>
<Content Include="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="appsettings.*.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@usausa
usausa / Index.razor
Last active April 8, 2022 10:27
BusyState
@page "/"
<button class="btn btn-primary" @onclick="OnExecuteClock">Execute</button>
@code {
[CascadingParameter]
[AllowNull]
public ProgressState Progress { get; set; }
private async Task OnExecuteClock()
lang
  async
    async/await
    asynclocal
    awaiter
    calcellation
    channels
    configure-await
 continuations
const aws = require('aws-sdk');
const lambda = new aws.Lambda({
maxRetries: 10,
retryDelayOptions: {
base: 1000
}
});
const targets = process.env.TARGETS.split(',');
const warmer = process.env.AWS_LAMBDA_FUNCTION_NAME;
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeTrailingCommaInMultilineLists/@EntryIndexedValue">SUGGESTION</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeTrailingCommaInSinglelineLists/@EntryIndexedValue">SUGGESTION</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeTypeMemberModifiers/@EntryIndexedValue">SUGGESTION</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeTypeModifiers/@EntryIndexedValue">SUGGESTION</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=BuiltInTypeReferenceStyle/@EntryIndexedValue">SUGGESTION</s:String>
<
namespace ComponentManagement
{
using System;
using Microsoft.Extensions.DependencyInjection;
public static class Program
{
public static void Main(string[] args)
{