Skip to content

Instantly share code, notes, and snippets.

import { GameStatus } from './hangman/model'
import { Helper } from './hangman/helper'
import { timer, Subject } from 'rxjs'
import express from 'express'
import { reactiveHangman } from './hangman/reactive-hangman'
import { StateManager } from './hangman/state-manager'
import { take, distinctUntilKeyChanged } from 'rxjs/operators'
const app = express()
const port = 3000
export interface IGameState {
id: string
status: GameStatus
selectedLetters: string[]
lifeLeft: number
secretWordLength: number
knownSecretWord: string
timeLeft: number
}
import { Helper } from './helper'
import { Observable, combineLatest, Subject } from 'rxjs'
import {
refCount,
scan,
startWith,
switchMapTo,
takeUntil,
publishBehavior,
} from 'rxjs/operators'
import { v4 } from 'uuid'
import { random } from 'lodash'
import { merge } from 'ramda'
import { GameStatus, IGameState } from './model'
export class Helper {
static secretWords = [
'adventurous',
'courageous',
'extramundane',
import { IGameState } from './model'
import { Subject, Observable } from 'rxjs'
export class StateManager {
static state$Dict: { [key: string]: Observable<IGameState> } = {}
static letter$Dict: { [key: string]: Subject<string> } = {}
static setState$ = (key: string, state: Observable<IGameState>) => {
StateManager.state$Dict[key] = state
}
import { v4 } from 'uuid'
import { random } from 'lodash'
import { merge } from 'ramda'
import { GameStatus, IGameState } from './model'
export class Helper {
static secretWords = [
'adventurous',
'courageous',
'extramundane',
import {
trim,
match,
replace,
split,
test,
toLower,
toString,
toUpper,
partial,
import { FinalGoalState, finalGoalStateName } from './store/final-goal/final-goal.state';
import { Component, OnInit, OnDestroy, ViewChild, ElementRef } from '@angular/core';
import { Select, Store } from '@ngxs/store';
import { Observable, Subscription } from 'rxjs';
import { Navigate } from '@ngxs/router-plugin';
import { LocalStorageUtil } from './utils/local-storage.util';
import { UserState, userStateName } from './store/user/user.state';
import { IUserState } from './store/user/user.models';
import { length } from 'ramda';
import { IFinalGoalState, IFinalGoal } from './store/final-goal/final-goal.models';
<div class="page">
<gridster [options]="options" #dragContainer>
<gridster-item [item]="dashboard[0]">
<div class="container-500-500">
<div class="content"></div>
</div>
</gridster-item>
<gridster-item [item]="dashboard[1]">
<div class="container-500-500">
<div class="content"></div>
import { FinalGoalState, finalGoalStateName } from './store/final-goal/final-goal.state';
import { Component, OnInit, OnDestroy, ViewChild, ElementRef } from '@angular/core';
import { Select, Store } from '@ngxs/store';
import { fromEvent, Observable, Subscription } from 'rxjs';
import { Navigate } from '@ngxs/router-plugin';
import { LocalStorageUtil } from './utils/local-storage.util';
import { UserState, userStateName } from './store/user/user.state';
import { IUserState } from './store/user/user.models';
import { length } from 'ramda';
import { IFinalGoalState, IFinalGoal } from './store/final-goal/final-goal.models';