Skip to content

Instantly share code, notes, and snippets.

Avatar

Jeremy Likness JeremyLikness

View GitHub Profile
@JeremyLikness
JeremyLikness / Program.cs
Created Nov 2, 2020
StrawberryShake errors
View Program.cs
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Threading.Tasks;
namespace EFCoreContributors
{
public class Program
{
private const string PAT = "xyz";
@JeremyLikness
JeremyLikness / Program.cs
Created May 26, 2020
An example of LINQ at work
View Program.cs
using System;
using System.Collections.Generic;
using System.Linq;
namespace linqexample
{
public class Thing
{
private static int NextInt = 1;
View AddressBookService.cs
public override async Task<AddressBookList> GetAddressBookAsync(Empty request,
ServerCallContext context)
{
var objPersons = new AddressBookList();
var peopleWithPhoneNumbers = await _dataContext.People
.Include(p => p.Phones)
.AsNoTracking()
.ToListAsync();
@JeremyLikness
JeremyLikness / BlogClient.cs
Created May 14, 2020
A blog client that retries credentials
View BlogClient.cs
using BlazorCosmosWasm.Shared;
using Microsoft.EntityFrameworkCore;
using System;
using System.Net.Http;
using System.Net.Http.Json;
using System.Threading.Tasks;
namespace BlazorCosmosWasm.Client.Data
{
public class BlogClient : IBlogClient
@JeremyLikness
JeremyLikness / ApplicationCosmosDbContext.cs
Created May 14, 2020
A custom identity context to intercept user adds
View ApplicationCosmosDbContext.cs
using BlazorCosmosWasm.Server.Controllers;
using BlazorCosmosWasm.Server.Models;
using BlazorCosmosWasm.Shared;
using IdentityServer4.EntityFramework.Options;
using Microsoft.Azure.Cosmos;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Options;
using System.Diagnostics;
using System.Linq;
@JeremyLikness
JeremyLikness / CosmosController.cs
Created May 14, 2020
Cosmos token controllerr
View CosmosController.cs
using System.Threading.Tasks;
using IConfiguration = Microsoft.Extensions.Configuration.IConfiguration;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.Cosmos;
using BlazorCosmosWasm.Shared;
using Microsoft.AspNetCore.Identity;
using BlazorCosmosWasm.Server.Models;
namespace BlazorCosmosWasm.Server.Controllers
@JeremyLikness
JeremyLikness / CosmosExtensions.cs
Created May 14, 2020
Cosmos extensions for the server
View CosmosExtensions.cs
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using IdentityServer4.Extensions;
using Microsoft.AspNetCore.Identity;
using BlazorCosmosWasm.Server.Models;
using Microsoft.Azure.Cosmos;
using Microsoft.Extensions.Configuration;
namespace BlazorCosmosWasm.Server.Controllers
@JeremyLikness
JeremyLikness / main.wat
Created Feb 11, 2020
WASI "Hello, World"
View main.wat
(module
(type $t0 (func (param i32 i32 i32 i32) (result i32)))
(type $t1 (func))
(import "wasi_unstable" "fd_write" (func $fd_write (type $t0)))
(func $main (type $t1)
i32.const 0
i32.const 8
i32.store
i32.const 4
i32.const 22
@JeremyLikness
JeremyLikness / Deployments.md
Last active Nov 15, 2019
Example docs for deployments
View Deployments.md
@JeremyLikness
JeremyLikness / app.js
Created Oct 22, 2019
Vanilla.js rendering code
View app.js
const renderPost = (post, user) => {
const bodyDiv = Wrapper.generate("div", "", false)
.createChild("p", post.body)
.appendChild(Wrapper.generate("p", user.username).addClass("tooltip")
.appendChild(Wrapper.generate("span", `${user.name} `)
.appendChild(AnchorWrapper.generate(`mailto:${user.email}`, user.email))
.createChild("br", "")
.appendChild(AnchorWrapper.generate(
`https://maps.google.com?q=${user.address.geo.lat}, ${user.address.geo.lng}`,
"🌎 Locate"))