Skip to content

Instantly share code, notes, and snippets.

View amogower's full-sized avatar

andy g amogower

View GitHub Profile
@amogower
amogower / option.ts
Created April 28, 2020 18:38 — forked from s-panferov/option.ts
Option and Result types from Rust in TypeScript
interface Option<T> {
map <U>(fn: (a: T) => U): Option<U>;
isSome(): boolean;
isNone(): boolean;
isSomeAnd(fn: (a: T) => boolean): boolean;
isNoneAnd(fn: () => boolean): boolean;
unwrap(): T;
unwrapOr(def: T): T;
unwrapOrElse(f: () => T): T;
map<U>(f: (a: T) => U): Option<U>;

Keybase proof

I hereby claim:

  • I am amogower on github.
  • I am amogower (https://keybase.io/amogower) on keybase.
  • I have a public key ASBWBn3M50M9zOJJX4hDi2-dSDrKv6wTlZ_qRjofC3qCxwo

To claim this, I am signing this object:

@amogower
amogower / machine.js
Last active February 13, 2020 16:55
Generated by XState Viz: https://xstate.js.org/viz
const singleMachine = Machine({
id: "single",
initial: "default",
context: {
betId: undefined,
betName: "",
isEachWay: false,
stake: "",
warnings: []
},
@amogower
amogower / machine.js
Last active February 13, 2020 09:40
Generated by XState Viz: https://xstate.js.org/viz
const singleBetMachine = Machine({
id: 'singleBet',
initial: 'default',
context: {
isEachWay: false,
stake: '',
},
states: {
default: {
on: {
@amogower
amogower / machine.js
Last active September 16, 2019 09:06
Generated by XState Viz: https://xstate.js.org/viz
const singleBetMachine = Machine({
id: 'singleBet',
initial: 'initial',
context: {
stake: '',
},
states: {
initial: {},
},
});
@amogower
amogower / machine.js
Created September 7, 2019 09:26
Generated by XState Viz: https://xstate.js.org/viz
const isEmail = (email) => email.indexOf('@') > -1;
const machine = Machine({
id: 'betslip',
context: {
selectedBets: {},
selectedBetsOddsTotals: {},
freebetCache: {},
stakes: {
multiples: [],
@amogower
amogower / machine.js
Last active August 30, 2019 13:38
Generated by XState Viz: https://xstate.js.org/viz
const isEmail = (email) => email.indexOf('@') > -1;
const machine = Machine({
id: 'myoc',
context: {
hasAcceptedNewsletter: false,
hasAcceptedTerms: false,
email: '',
password: '',
stayLoggedIn: false,
@amogower
amogower / custom-vscode-workbench-styling.json
Created January 14, 2019 20:35
Custom VSCode Workbench Styling
{
"workbench.colorCustomizations": {
"sideBar.background": "#16232A",
"activityBar.background": "#16232A",
"activityBar.border": "#3C3C3C",
"activityBarBadge.background": "#ffc02d",
"activityBarBadge.foreground": "#16232A",
"input.background": "#16232A",
"tab.inactiveForeground": "#AAAAAA",
"tab.activeBackground": "#303D46",
@amogower
amogower / settings.json
Created October 1, 2018 07:51
VS Code Settings
// Place your settings in this file to overwrite the default settings
{
"editor.fontFamily": "Liga Dank Mono",
// "editor.fontFamily": "Operator Mono Lig",
// "editor.fontFamily": "Fira Code",
// "editor.fontWeight": "400",
"editor.fontSize": 14,
"editor.fontLigatures": true,
"window.zoomLevel": -1,
"editor.minimap.enabled": true,
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Check Test Benchmark</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>