Skip to content

Instantly share code, notes, and snippets.

@SQL-MisterMagoo
SQL-MisterMagoo / MyBase.cs
Created September 6, 2020 01:01
Provide content from a base component that is not overridden
public class MyBase : ComponentBase
{
string someValue = "test";
public MyBase()
{
var rf = typeof(ComponentBase).GetField("_renderFragment", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
var pqr= typeof(ComponentBase).GetField("_hasPendingQueuedRender", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
var nr= typeof(ComponentBase).GetField("_hasNeverRendered", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
rf.SetValue(this, (RenderFragment)(builder =>
{
@SQL-MisterMagoo
SQL-MisterMagoo / ChangeDefaultBranch.ps1
Created June 15, 2020 16:58
Change default branch on all your Github repos
$token = <your github personal token>
$headers = @{"Authorization"="token $token"}
$body = (ConvertTo-Json @{ default_branch='main' })
Write-Host "Fetching repo list"
[Console]::Out.Flush()
$repos = Invoke-RestMethod -Headers $headers -Method GET -Uri "https://api.github.com/user/repos?type=owner&per_page=80"
foreach($repo in $repos) {
if($repo.default_branch -eq "master")
{
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Input Test</title>
<style>
.container {
width:90%;
max-width:900px;
@SQL-MisterMagoo
SQL-MisterMagoo / App.razor
Created April 24, 2020 16:30
TouchEvents example
<main @ontouchstart="TouchStart" @ontouchend="TouchEnd" style="height:100vh;">
<Router AppAssembly="@typeof(Program).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
</Found>
<NotFound>
<LayoutView Layout="@typeof(MainLayout)">
<p>Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
@SQL-MisterMagoo
SQL-MisterMagoo / example.razor
Created April 23, 2020 23:20
DoubleClickAndBlur
<table class="table-bordered">
<tr>
<td @ondblclick="StartEdit">
@if (Editing)
{
<input @bind="Name" @onblur="EndEdit" />
}
else
{
<span>@(Name ?? "double-click here")</span>
@SQL-MisterMagoo
SQL-MisterMagoo / index.html
Last active March 19, 2020 19:30
Monitor Blazor WASM loading and report errors
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Blazor Loading</title>
<base href="/" />
<link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" />
<link href="css/site.css" rel="stylesheet" />
</head>
@SQL-MisterMagoo
SQL-MisterMagoo / BrowserRenderer.ts
Last active November 30, 2019 00:18
Playing with autofocus
import { RenderBatch, ArrayBuilderSegment, RenderTreeEdit, RenderTreeFrame, EditType, FrameType, ArrayValues } from './RenderBatch/RenderBatch';
import { EventDelegator } from './EventDelegator';
import { EventForDotNet, UIEventArgs, EventArgsType } from './EventForDotNet';
import { LogicalElement, PermutationListEntry, toLogicalElement, insertLogicalChild, removeLogicalChild, getLogicalParent, getLogicalChild, createAndInsertLogicalContainer, isSvgElement, getLogicalChildrenArray, getLogicalSiblingEnd, permuteLogicalChildren, getClosestDomElement } from './LogicalElements';
import { applyCaptureIdToElement } from './ElementReferenceCapture';
import { EventFieldInfo } from './EventFieldInfo';
import { dispatchEvent } from './RendererEventDispatcher';
import { attachToEventDelegator as attachNavigationManagerToEventDelegator } from '../Services/NavigationManager';
const selectValuePropname = '_blazorSelectValue';
const sharedTemplateElemForParsing = document.createElement('template');
@SQL-MisterMagoo
SQL-MisterMagoo / CSSProperties.cs
Last active November 22, 2019 13:56
C# Class for CSS Properties with ToString() override suitable for a `style` attribute - https://github.com/SQL-MisterMagoo/SampleStyle
using System.Reflection;
using System.Text;
using System.Text.Json.Serialization;
public class CssProperties
{
[JsonPropertyName("align-content")] public string AlignContent { get; set; }
[JsonPropertyName("align-items")] public string AlignItems { get; set; }
[JsonPropertyName("alignment-baseline")] public string AlignmentBaseline { get; set; }
[JsonPropertyName("align-self")] public string AlignSelf { get; set; }
@SQL-MisterMagoo
SQL-MisterMagoo / ConnectionManager.cs
Created February 27, 2019 00:10
Merged b1 to dev
using McMaster.Extensions.CommandLineUtils;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Newtonsoft.Json;
using StreamDeckLib.Messages;
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net.WebSockets;

Keybase proof

I hereby claim:

  • I am sql-mistermagoo on github.
  • I am mistermagoo (https://keybase.io/mistermagoo) on keybase.
  • I have a public key ASCTkLaGBA_EDhhbNjGEqQ4XvGa8yX4oYSS27T4ZoaIeZgo

To claim this, I am signing this object: