Skip to content

Instantly share code, notes, and snippets.

Ed Charbeneau EdCharbeneau

Block or report user

Report or block EdCharbeneau

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
@EdCharbeneau
EdCharbeneau / ThemeManager.cshtml
Last active Jan 16, 2019
Kendo UI css dependencies
View ThemeManager.cshtml
<select onchange=@HandleThemeChange>
@foreach (var t in themes)
{
<option value=@t>@t</option>
}
</select>
@functions {
string[] themes = { "Default", "Bootstrap", "Material" };
@EdCharbeneau
EdCharbeneau / MyProject.csproj
Last active Dec 4, 2018
Compile scss with dotnet CLI
View MyProject.csproj
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Folder Include="css\" />
<Folder Include="wwwroot\" />
</ItemGroup>
@EdCharbeneau
EdCharbeneau / Startup.cs
Created Oct 12, 2018
InMemoryDB Seeding from Startup.cs
View Startup.cs
using Microsoft.AspNetCore.Blazor.Server;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.ResponseCompression;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json.Serialization;
using StateHasChanged4.Server.Models;
using System.Linq;
using System.Net.Mime;
using Microsoft.EntityFrameworkCore;
@EdCharbeneau
EdCharbeneau / MyRazor.cshtml
Last active Sep 26, 2018
Moving JS outside of Razor
View MyRazor.cshtml
<div>
Razor things go here
</div>
@section Scripts {
<script src="myModule.js"></script>
<script>
myModule.init({
someRoute: @Url.Action("myRoute"),
someSetting: @Model.SomeSettingValue
@EdCharbeneau
EdCharbeneau / editor.html
Created Aug 29, 2018
CSS Strike in Kendo UI Editor
View editor.html
<!DOCTYPE html>
<html>
<head>
<style>html { font-size: 14px; font-family: Arial, Helvetica, sans-serif; }</style>
<title></title>
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.2.620/styles/kendo.common-material.min.css" />
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.2.620/styles/kendo.material.min.css" />
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.2.620/styles/kendo.material.mobile.min.css" />
View sample.css
.st {
text-decoration: line-through;
}
@EdCharbeneau
EdCharbeneau / MyComponent.cshtml
Created Aug 29, 2018
Working with the Blazor JavaScript Interop 5
View MyComponent.cshtml
<div onclick="@HandleClick" class="my-component">
@Message
</div>
@functions {
string Message = "Click to change";
async void HandleClick()
{
Message = await PromptInterop.PromptAsync("Type a message");
StateHasChanged();
@EdCharbeneau
EdCharbeneau / PromptInterop.cs
Last active Aug 29, 2018
Working with the Blazor JavaScript Interop 4
View PromptInterop.cs
using Microsoft.JSInterop;
public class PromptInterop
{
/// <summary>
/// Invokes a browser prompt and returns the user's input.
/// </summary>
public static Task<string> PromptAsync(string message) {
return JSRuntime.Current.InvokeAsync<string>("myNamespace.showPrompt",message);
}
@EdCharbeneau
EdCharbeneau / PromptInterop.cs
Created Aug 29, 2018
Working with the Blazor JavaScript Interop 3
View PromptInterop.cs
using Microsoft.JSInterop;
public class PromptInterop
{
/// <summary>
/// Invokes a browser prompt and returns the user's input.
/// </summary>
public static Task<string> PromptAsync(string message) {
return JSRuntime.Current.InvokeAsync<string>("myNamespace.showPrompt",message);
}
@EdCharbeneau
EdCharbeneau / promptInterop.js
Last active Aug 29, 2018
Working with the Blazor JavaScript Interop 2
View promptInterop.js
window.myNamespace = {
showPrompt: function (message) {
return prompt(message, 'Type anything here');
},
anotherFunction: function(args) { 
// do stuff 
}
};
You can’t perform that action at this time.