Skip to content

Instantly share code, notes, and snippets.

Zlati Pehlivanov talamaska

  • Bulgaria
Block or report user

Report or block talamaska

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View chips.dart
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
// See: https://twitter.com/shakil807/status/1042127387515858949
// https://github.com/pchmn/MaterialChipsInput/tree/master/library/src/main/java/com/pchmn/materialchips
// https://github.com/BelooS/ChipsLayoutManager
void main() => runApp(ChipsDemoApp());
@talamaska
talamaska / Dart Class.dart
Created Jan 11, 2019 — forked from buntagonalprism/Dart Class.dart
Flutter and Dart collection of file templates for Android Studio development
View Dart Class.dart
#set( $nameparts = $NAME.split("_"))
#set( $namepart = '')
#set( $classname = '')
#foreach( $namepart in $nameparts )
#set( $classname = $classname + $namepart.substring(0, 1).toUpperCase() + $namepart.substring(1))
#end
class $classname {
// TODO: add class properties and methods
View custom.overlay.config.ts
interface CustomOverlayConfig {
hasBackdropClick?: boolean;
isCentered?: boolean;
size?: any;
top?: string;
}
const DEFAULT_CUSTOM_CONFIG: CustomOverlayConfig = {
hasBackdropClick: false,
isCentered: true,
View confirmation.modal.ref.ts
import { OverlayRef } from '@angular/cdk/overlay';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { Subject } from 'rxjs/Subject';
export class ConfirmationModalOverlayRef {
public events = new BehaviorSubject<any>(null);
constructor(private overlayRef: OverlayRef) { }
public close(): void {
this.overlayRef.dispose();
}
@talamaska
talamaska / form.modal.component.ts
Last active Mar 20, 2019
component portal modals
View form.modal.component.ts
this.isSuccessSub = this.isSuccess$.subscribe((isSuccess) => {
if (isSuccess) {
this.dialogRef.close();
}
});
@talamaska
talamaska / loading-spinner.service.ts
Created May 15, 2018 — forked from caroso1222/loading-spinner.service.ts
Angular CDK - Portal and PortalHost
View loading-spinner.service.ts
import {
Injectable,
ComponentFactoryResolver,
ApplicationRef,
Injector
} from '@angular/core';
import {
ComponentType,
Portal,
ComponentPortal,
@talamaska
talamaska / recipe.example.md
Created Feb 20, 2018 — forked from peterbsmith2/recipe.example.md
Making chained API Calls using @ngrx/Effects
View recipe.example.md

Making chained API Calls using @ngrx/Effects

Purpose

This recipe is useful for cooking up chained API calls as a result of a single action.

Description

In the below example, a single action called POST_REPO is dispatched and it's intention is to create a new repostiory on GitHub then update the README with new data after it is created.
For this to happen there are 4 API calls necessary to the GitHub API:

  1. POST a new repostiry
  2. GET the master branch of the new repository
  3. GET the files on the master branch
View line.effect.ts
import { Store, Action } from '@ngrx/store';
import { Actions, Effect } from '@ngrx/effects';
import { ADD_LINE } from './lines.reducer';
import { INC_PAGE_COUNT } from './pages.reducer';
import { AppState } from './app.store';
@Injectable()
export class LineEffects {
@talamaska
talamaska / conditional_effects.ts
Created Feb 20, 2018 — forked from vespertilian/conditional_effects.ts
Two options for conditional ngrx effects
View conditional_effects.ts
@Effect()
selectAndLoadStore$: Observable<Action> = this.actions$
.ofType(storeActions.SELECT_AND_LOAD_STORE)
.withLatestFrom(this.store.select(ngrx.storeState))
.map(([action, storeState]) => [action.payload, storeState])
.switchMap(([storeName, storeState]) => {
const existsInStore = Boolean(storeState.urlNameMap[storeName]);
return Observable.if(
() => existsInStore,
Observable.of(new storeActions.SetSelectedStore(storeName)),
View ngrx-effects-advance-example.js
// Nothing changed here, works as previously.
@Effect() actionX$ = this.updates$
.ofType('ACTION_X')
.map(toPayload)
.switchMap(payload => this.api.callApiX(payload)
.map(data => ({type: 'ACTION_X_SUCCESS', payload: data}))
.catch(err => Observable.of({type: 'ACTION_X_FAIL', payload: err}))
);
You can’t perform that action at this time.