This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
import './polyfills' | |
import * as commander from 'commander' | |
import * as inquirer from 'inquirer' | |
import chalk from 'chalk' | |
import * as actions from './logic'; | |
import { getIdQuestions, questions, updateContactQuestions } from './questions' | |
commander | |
.version('1.0.0') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String.prototype.plural = function () { | |
if (this.lastChar() === 'y') { | |
if ( (this.charAt(this.length - 2)).isVowel() ) { | |
// If the y has a vowel before it (i.e. toys), then you just add the s. | |
return this + 's'; | |
} | |
else { | |
// If a this ends in y with a consonant before it (fly), you drop the y and add -ies to make it plural. | |
return this.slice(0, -1) + 'ies'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "myapp", | |
"version": "0.0.0", | |
"license": "MIT", | |
"scripts": { | |
"ng": "ng", | |
"start": "ng serve", | |
"build": "ng build", | |
"test": "ng test", | |
"lint": "ng lint", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "scotchy-scotch", | |
"version": "0.0.0", | |
"license": "MIT", | |
"scripts": { | |
"ng": "ng", | |
"start": "ng serve", | |
"build": "ng build", | |
"test": "ng test", | |
"lint": "ng lint", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<app-linklist [articles]='article | async | sort'></app-linklist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//src/app/redux/sort.pipe.ts | |
import { Pipe, PipeTransform } from '@angular/core'; | |
import { Article } from './models/article'; | |
@Pipe({ | |
name: 'sort' | |
}) | |
export class SortPipe implements PipeTransform { | |
transform(articles: Article[], args?: any): Article[] { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<app-linklist [articles]='article | async'></app-linklist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<app-linklist [articles]='article'></app-linklist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.article = this.store.select(fromArticle.getArticles) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//src/app/app.component.ts | |
article: Observable<Article[]> | |
constructor(private store: Store<fromArticle.State>){ | |
this.article = this.store.select(fromArticle.getArticles).subscribe((v: Array<Article>) => { | |
this.article = v.sort((a: Article, b: Article) => { | |
return b.points - a.points | |
}) | |
}) | |
} |