Skip to content

Instantly share code, notes, and snippets.

View codingedgar's full-sized avatar
👨‍🔬

Edgar Rodriguez codingedgar

👨‍🔬
View GitHub Profile
@codingedgar
codingedgar / example2-draw-different-circles.html
Last active November 16, 2020 23:54
Draw different shapes to demonstrate arc
<!DOCTYPE html>
<html>
<body>
<canvas id="myCanvas" width="150" height="200" style="border:1px solid #d3d3d3;">
Your browser does not support the HTML canvas tag.
</canvas>
<script>
@codingedgar
codingedgar / example2-draw-circle.html
Last active November 16, 2020 23:54
Draw a circle with HTML Canvas
<!DOCTYPE html>
<html>
<body>
<canvas id="myCanvas" width="200" height="100" style="border:1px solid #d3d3d3;">
Your browser does not support the HTML canvas tag.
</canvas>
<script>
@codingedgar
codingedgar / example2-playerx.tsx
Last active November 16, 2020 23:49
example2 player x
const BOARD_SIZE = 208 as const;
const BOARD_PADDING = 4 as const;
const LINE_WIDTH = 8 as const;
const LINE_CAP_SIZE = LINE_WIDTH / 2;
const CELL_SIZE = 64 as const;
const CELL_PADDING = 4 as const;
const CELL_CENTER = CELL_SIZE / 2;
const COLOR1 = '#FFD103';
const COLOR2 = '#A303FF';
const COLOR3 = '#CCCCCC';
@codingedgar
codingedgar / example2-draw-line.html
Last active November 16, 2020 23:53
example2 draw line
<!DOCTYPE html>
<html>
<body>
<canvas id="myCanvas" width="200" height="100" style="border:1px solid #d3d3d3;">
Your browser does not support the HTML canvas tag.
</canvas>
<script>
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
@codingedgar
codingedgar / example2-board-canvas.tsx
Last active November 16, 2020 23:47
example 2 board canvas
const BOARD_SIZE = 208 as const;
const BOARD_PADDING = 4 as const;
const LINE_WIDTH = 8 as const;
const LINE_CAP_SIZE = LINE_WIDTH / 2;
const CELL_SIZE = 64 as const;
const CELL_PADDING = 4 as const;
const CELL_CENTER = CELL_SIZE / 2;
const COLOR1 = '#FFD103';
const COLOR2 = '#A303FF';
const COLOR3 = '#CCCCCC';
@codingedgar
codingedgar / example1-ui.tsx
Last active October 15, 2020 15:34
example1 ui
function App() {
const [state, send] = useMachine(machine)
return (
< div
style={{
display: 'grid',
gridTemplateColumns: '36px 36px 36px',
gridTemplateRows: '36px 36px 36px 36px 36px',
@codingedgar
codingedgar / example1-state-machine.ts
Last active October 15, 2020 15:44
example1 state machine
const machine = Machine<Context, Scheme, Event>({
strict: true,
initial: 'X',
context: DEFAULT_CONTEXT,
states: {
X: {
always: {
cond: CONDITIONS.IS_DONE,
target: 'DONE',
},
@codingedgar
codingedgar / example1-types.ts
Last active October 15, 2020 15:45
example1 types
type Player = 'X' | 'O'
type Coordinate = 1 | 2 | 3
type Coordinates = { row: Coordinate; column: Coordinate }
type CellState = { kind: 'Playable' } | { kind: 'Played', player: Player }
type Cell = Coordinates & { state: CellState }
@codingedgar
codingedgar / CreateClusterSharding.fsx
Last active September 21, 2020 20:02
f# akka.net akkling minimal cluster sharding config
#load ".paket/load/netstandard2.0/Akka.Serialization.Hyperion.fsx"
#load ".paket/load/netstandard2.0/Akka.Cluster.Sharding.fsx"
#r "packages/Akkling/lib/netstandard2.0/Akkling.dll"
#r "packages/Akkling.Persistence/lib/netstandard2.0/Akkling.Persistence.dll"
#r "packages/Akkling.Cluster.Sharding/lib/netstandard2.0/Akkling.Cluster.Sharding.dll"
open System
open System.Threading
open Akkling
open Akkling.Cluster.Sharding
@codingedgar
codingedgar / CreateActorAkkaNET.fsx
Last active September 18, 2020 14:46
f# akka.net akkling minimal config
#r "packages/Hyperion/lib/netstandard2.0/Hyperion.dll"
#r "packages/Newtonsoft.Json/lib/netstandard2.0/Newtonsoft.Json.dll"
#r "packages/Akka.Serialization.Hyperion/lib/netstandard2.0/Akka.Serialization.Hyperion.dll"
#r "packages/Akka/lib/netstandard2.0/Akka.dll"
#r "packages/Akkling/lib/netstandard2.0/Akkling.dll"
open System
open Akka
open Akkling