This file contains hidden or 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
| import { describe, it, expect, beforeEach } from '@angular/core/testing'; | |
| import { InvalidPipeArgumentException } from '@angular/common/src/pipes/invalid_pipe_argument_exception'; | |
| import { ConversionPipe } from './conversion.pipe'; | |
| describe('ConversionPipe', () => { | |
| let pipe: ConversionPipe; | |
| beforeEach(() => { | |
| pipe = new ConversionPipe(); |
This file contains hidden or 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
| const graphqlHTTP = require('express-graphql'); | |
| const express = require('express'); | |
| import { schema } from './schema/schema'; | |
| // Can I use something from graphql-tools with my schema... | |
| // import { <something-here> } from 'graphql-tools'; | |
| // ...and then feed it to my express() server below? | |
| const port = 3000; |
This file contains hidden or 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
| version: '2' | |
| services: | |
| mongodb: | |
| image: mongo:3.2.6 | |
| ports: | |
| - "27017:27017" | |
| mongo-seed: | |
| image: mongo:3.2.6 |
This file contains hidden or 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
| class Queue extends Subject<any> { | |
| private items; | |
| add(item) { | |
| if(this.observers.length > 0) { | |
| this.next(item); | |
| } else { | |
| this.items.push(item); | |
| } | |
| } |
This file contains hidden or 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
| function justDoIt(color, { size, model }) { | |
| console.log(`Laced up the size ${size} ${model} kicks (${color})`); | |
| } | |
| let shoe = { | |
| size: 9.5, | |
| model: 'Air Jordan Retro 4' | |
| }; | |
| justDoIt('black', shoe); |
This file contains hidden or 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
| export function buildInitials(...fields: string[]) { | |
| return fields.reduce((acc, val) => { | |
| acc += val.length > 0 ? val[0] : ''; | |
| return acc.toUpperCase(); | |
| }, ''); | |
| } |
This file contains hidden or 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
| // Only exported types will be able to be imported elsewhere | |
| export { BackendProviderModule } from './src/backend-provider.module'; | |
| export { BackendService } from './src/backend.service'; | |
| // leave out the private stuff, like that Helpers class |
This file contains hidden or 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
| // Add this one to an AppModule imports | |
| import { BackendProviderModule } from '@myproject/backend-provider'; | |
| // Use this one in the AppComponent for constructor injection | |
| import { BackendService } from '@myproject/backend-provider'; |
This file contains hidden or 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
| import { ActivatedRoute } from '@angular/router'; | |
| export function getFullTreeParams(route: ActivatedRoute, params = {}) { | |
| if (route) { | |
| params = {...params, ...route.snapshot.params}; | |
| } | |
| return route.parent | |
| ? this.getFullTreeParams(route.parent, params) | |
| : params; | |
| } |
This file contains hidden or 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
| import { ActivatedRouteSnapshot } from '@angular/router'; | |
| export function getFullTreeParams(route: ActivatedRouteSnapshot, params = {}) { | |
| if (route) { | |
| params = {...params, ...route.params}; | |
| } | |
| return route.firstChild | |
| ? this.getFullTreeParams(route.firstChild, params) | |
| : params; | |
| } |
OlderNewer