Skip to content

Instantly share code, notes, and snippets.

View pkellner's full-sized avatar

Peter Kellner pkellner

View GitHub Profile
const withCSS = require('@zeit/next-css');
require('dotenv').config();
const path = require('path');
const Dotenv = require('dotenv-webpack');
const withImages = require('next-images');
const withTypescript = require('@zeit/next-typescript');
const withOffline = require('next-offline');
//const isProd = process.env.NODE_ENV === 'production';
using System;
using System.Collections.Concurrent;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Caching.Memory;
namespace ClassLib.CacheExtension
{
public class TCache<T>
{
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using EFLibSvcc.Models;
using Microsoft.EntityFrameworkCore;
namespace CarvedRock.Api.Repositories
{
public class RoomRepository
{
using System.Collections.Generic;
using System.Threading.Tasks;
using ClassLib.CacheExtension;
using EFLibSvcc.Models;
using Microsoft.Extensions.Caching.Memory;
namespace CarvedRock.Api.Repositories
{
public class RoomRepositoryCached
{
const { ApolloServer, gql } = require("apollo-server");
const typeDefs = gql`
type Speaker {
id: ID!
first: String
last: String
favorite: Boolean
}
type SpeakerResults {
@pkellner
pkellner / button.html
Created October 14, 2020 21:34
Button Click To Sort GraphQL Cache
<Button color="warning" onClick={() => {
const { speakers } = apolloClient.cache.readQuery({ query: GET_SPEAKERS });
apolloClient.cache.writeQuery({
query: GET_SPEAKERS,
data: {
speakers: {
datalist: [...speakers.datalist].sort((a,b) => a.id - b.id)
},
},
});
<Button color="warning" onClick={() => {
const { speakers } = apolloClient.cache.readQuery({ query: GET_SPEAKERS });
apolloClient.cache.writeQuery({
query: GET_SPEAKERS,
data: {
speakers: {
datalist: [...speakers.datalist].sort((a,b) => a.id - b.id)
},
},
using System;
using System.Collections.Generic;
namespace WebAppReactCRA.GraphQL.Speakers
{
// Root myDeserializedClass = JsonConvert.DeserializeObject<Root>(myJsonResponse);
public class AttendeesAmazonBookDto {
public int Id { get; set; }
public string AmazonImageSmall { get; set; }
public string BookTitle { get; set; }
@pkellner
pkellner / machine.js
Last active January 25, 2021 23:57
Generated by XState Viz: https://xstate.js.org/viz
const svccUiMachine1 = Machine({
id: 'svccUiMachine1',
context: {
},
type: 'parallel',
states: {
codeCampYear: {
initial: "2019",
states: {
@pkellner
pkellner / machine.js
Last active January 26, 2021 00:57
Generated by XState Viz: https://xstate.js.org/viz
svccUiMachine1 = Machine({
id: 'svccUiMachine1',
context: {
currentCodeCampYear: '2019',
codeCampYears: [
'2005',
'2006',
'2007',
'2008',
'2009',