Skip to content

Instantly share code, notes, and snippets.

Avatar

Gareth Oates GarethOates

View GitHub Profile
View self-signed-certificate-with-custom-ca.md

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@GarethOates
GarethOates / Weapon.cs
Created Jan 27, 2020
A more generic equipment class
View Weapon.cs
using System;
namespace MagicTheProgramming
{
public class Weapon : CreatureDecorator, ICreature
{
protected int _powermodifier;
protected int _toughnessmodifier;
public Weapon(ICreature creature, int powermod, int toughnessmod)
View Shield.cs
using System;
namespace MagicTheProgramming
{
public class Shield : CreatureDecorator, ICreature
{
public Shield(ICreature creature) : base(creature) {}
public override int Toughness => base.Toughness + 1;
}
@GarethOates
GarethOates / Program.cs
Last active Jan 27, 2020
Decorator Pattern Output
View Program.cs
using System;
using System.Linq;
using System.Collections.Generic;
namespace MagicTheProgramming
{
class Program
{
static void Main(string[] args)
{
View Sword.cs
using System;
namespace MagicTheProgramming
{
public class Sword : CreatureDecorator, ICreature
{
public Sword(ICreature creature) : base(creature) {}
public override int Toughness => base.Toughness + 1;
public override int Power => base.Power + 1;
View CreatureDecorator.cs
using System;
namespace MagicTheProgramming
{
public class CreatureDecorator : ICreature
{
protected ICreature _creature;
public CreatureDecorator(ICreature creature)
{
View ICreature.cs
using System;
namespace MagicTheProgramming
{
public interface ICreature
{
int Power {get;}
int Toughness {get;}
string Name {get;}
}
@GarethOates
GarethOates / Creature.cs
Last active Jan 27, 2020
Magic the Programming: Decorator Pattern
View Creature.cs
using System;
namespace MagicTheProgramming
{
public class Creature : ICreature
{
public int Power {get;}
public int Toughness {get;}
public string Name {get;}
@GarethOates
GarethOates / index.js
Last active Sep 9, 2018
Creation of a Drizzle Redux Store
View index.js
import { Drizzle, generateStore } from 'drizzle';
import options from './drizzleOptions';
const drizzleStore = generateStore(options);
const drizzle = new Drizzle(options, drizzleStore);
drizzleStore.subscribe(() => {
const state = drizzleStore.getState();
// We'll make use of this state object later on when
View drizzleOptions.js
import CoinToss from '@edgefund/core/build/contracts/CoinToss';
export default {
contracts: [
CoinToss
],
events: {
CoinToss: ['betPlaced', 'bankRollFunded']
},
polls: {
You can’t perform that action at this time.