Skip to content

Instantly share code, notes, and snippets.

const observable = of('response')
observable.pipe(first()).subscribe(result => {
// Do the logic with the result emited by the observable
// .................
// .................
// .................
});
const observable = of('response')
observable.subscribe(result => {
// Do the logic with the result emited by the observable
// .................
// .................
// .................
});
// Delete all data in elasticsearch
curl -X DELETE 'http://localhost:9200/_all'
// Backup data to data.json
elasticdump --input=data.json --output=http://localhost:9200 --type=data
// Import data.json to elasticsearch
elasticdump --input=http://localhost:9200/ --output=data.json --type=data --limit 50000
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';
<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 { 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';
import {
trim,
match,
replace,
split,
test,
toLower,
toString,
toUpper,
partial,
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',