Skip to content

Instantly share code, notes, and snippets.

View GarethOates's full-sized avatar

Gareth Oates GarethOates

View GitHub Profile

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 January 27, 2020 23:30
A more generic equipment class
using System;
namespace MagicTheProgramming
{
public class Weapon : CreatureDecorator, ICreature
{
protected int _powermodifier;
protected int _toughnessmodifier;
public Weapon(ICreature creature, int powermod, int toughnessmod)
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 January 27, 2020 23:33
Decorator Pattern Output
using System;
using System.Linq;
using System.Collections.Generic;
namespace MagicTheProgramming
{
class Program
{
static void Main(string[] args)
{
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;
using System;
namespace MagicTheProgramming
{
public class CreatureDecorator : ICreature
{
protected ICreature _creature;
public CreatureDecorator(ICreature creature)
{
using System;
namespace MagicTheProgramming
{
public interface ICreature
{
int Power {get;}
int Toughness {get;}
string Name {get;}
}
@GarethOates
GarethOates / Creature.cs
Last active January 27, 2020 18:21
Magic the Programming: Decorator Pattern
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 September 9, 2018 13:37
Creation of a Drizzle Redux Store
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
import CoinToss from '@edgefund/core/build/contracts/CoinToss';
export default {
contracts: [
CoinToss
],
events: {
CoinToss: ['betPlaced', 'bankRollFunded']
},
polls: {