Skip to content

Instantly share code, notes, and snippets.

View EdCharbeneau's full-sized avatar
🏠
Working from home

Ed Charbeneau EdCharbeneau

🏠
Working from home
View GitHub Profile
@EdCharbeneau
EdCharbeneau / ExampleMetadata.cs
Last active May 3, 2020 14:28
Create a menu from Application components.
using Microsoft.AspNetCore.Components;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Reflection;
using System.Text.RegularExpressions;
public static class ExampleMetadata
{
public static IEnumerable<MenuItem> GetItems()
@EdCharbeneau
EdCharbeneau / foo.ts
Last active April 17, 2020 22:04
TypeWtf
export MyClass {
private foo: string = "hello";
public addHandler() {
window.addEventListener("resize", this.logResize);
}
public logResize() {
console.log(this); // Expected: MyClass | Actual: Window
ABOUT ED:
Ed is a Microsoft MVP and an international speaker, writer, online influencer, a Developer Advocate for Progress - [Telerik UI for Blazor](https://www.telerik.com/blazor-ui), and expert on all things web development. Ed enjoys geeking out to cool new tech, brainstorming about future technology, and admiring great design.
@EdCharbeneau
EdCharbeneau / Index.razor.cs
Last active January 27, 2020 22:58
Cancelable Event
void HandleTabChange(TabEventArgs args)
{
var value = (Foo)args.Value;
if (value.Id == 1)
{
args.Cancel = true;
}
else
{
SelectedItem = value;
@EdCharbeneau
EdCharbeneau / AlertBox.razor
Last active August 17, 2020 17:26
EventCallbacks
<div class="alert alert-danger">
@ChildContent
</div>
@code {
[Parameter] public RenderFragment ChildContent { get; set; }
}
@EdCharbeneau
EdCharbeneau / little-guy.md
Created November 20, 2019 21:37
But I'm an independent contractor.

Today I went to the lumber yard to get some tools and materials. I explained to the manager that I was building a deck for a neighbor and I needed supplies. I explained that I'm an independent contractor and I would like all of the tools and materials for free since I'm really not making a huge profit yet, and I'm only a small one person business. The manager said I could borrow some tools for 30 days, but had to buy them at the end of the trial period. He wasn't flexible on pricing for lumber either, I guess he just doesn't care about the small contractor AT ALL! I think I can get some pallets from the recycling center, enough to get started and move on to the next project. Maybe when I get ready for my next job these big companies will finally care about the little guy. Running a small independent contracting business is so difficult these days because of this.

@if (IsLoading)
{
@LoadingTemplate
}
else
{
@ContentTemplate
}
@code {
@EdCharbeneau
EdCharbeneau / FetchData.razor
Created August 15, 2019 17:15
Working Grid with Template
@page "/fetchdata"
@inject HttpClient Http
@using Telerik.Blazor.Components.Grid
<h1>Weather forecast</h1>
<p>This component demonstrates fetching data from the server.</p>
<TelerikGrid Data="@forecasts" Pageable="true" Sortable="true" Filterable="true">
<TelerikGridColumns>
@EdCharbeneau
EdCharbeneau / masonry.css
Created June 17, 2019 14:36
Simple Masonry CSS
.masonry {
display: flex;
flex-flow: column wrap;
max-height: 800px;
margin-left: -8px; /* Adjustment for the gutter */
width: 100%;
}
.masonry > div {
margin: 0 8px 8px 0; /* Some gutter */
@EdCharbeneau
EdCharbeneau / Test.razor
Created May 21, 2019 16:09
Telerik UI for Blazor Drop Down Enum
<TelerikDropDownList Data="@ModeList" TextField="Text" ValueField="Value" bind-Value="@selectedValue">
</TelerikDropDownList>
<span>Selected: @((Modes)selectedValue)</span>
@functions {
int selectedValue { get; set; } = 0;
public class ModeViewModel