Skip to content

Instantly share code, notes, and snippets.

Peter "Shawty" Shaw shawty

Block or report user

Report or block shawty

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@shawty
shawty / GridEditor.razor
Last active Nov 13, 2019
Blazor component to allow editing of a data table using a simple grid and drop down
View GridEditor.razor
@using Microsoft.AspNetCore.Components
@using Microsoft.AspNetCore.Components.Web
@using MyProject.DataModels
@inject MyProject.Services.ClientGridData _gridDataService
@inject MyProject.Services.Clients _dropDownDataService
<div class="row d-flex align-items-center">
<div class="col">
@shawty
shawty / _BS4Validation.cshtml
Last active Nov 6, 2019
Quick & dirty but very simple ASP.NET MVC Partial that allows you to use the MVC/Razor validation attributes on your models, but have the classes on those models work with Bootstrap 4's validation styles.
View _BS4Validation.cshtml
<script>
let errorElements = Array.from(document.getElementsByClassName("input-validation-error"));
errorElements.forEach(element => {
let inputElement = $(element);
let messageDiv = inputElement.next("div");
if (messageDiv) {
messageDiv.text(inputElement.data("val-required"));
@shawty
shawty / instructions.txt
Created Apr 24, 2019
Instructions on how to get the latest dotnet core 3 (as of 24th April 2019) and Blazor running on a Raspberry PI
View instructions.txt
First things first, make sure your Raspberry PI has the latest updates for Raspbian on by running
sudo apt-get -y update
sudo apt-get -y upgrade
Also make sure that your running this on a version 2 raspberry PI or higher (I tested this on a Quad Core V3 B+, and a V2 PI Zero)
This will NOT WORK on any PI model that's older, I tried it on an original V1 and to say it wasn't happy, was an understatement :-)
Right, prerequisates:
@shawty
shawty / JwtDecoder.cs
Created Apr 11, 2019
Quick and dirty JWT Token decoder class to use in Blazor based projects, since trying to use the official MS Jwt Token libs at present causes things to blow up. :-)
View JwtDecoder.cs
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;
namespace IntranetV6.Client.Classes
{
public static class StringExtensions
{
public static int GetNextHighestMultiple(this int source, int multipicand)
You can’t perform that action at this time.