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
export class GithubSearchCurryService extends BaseGithubSearch { | |
searchClient!: (term: string) => Observable<any>; | |
constructor(http: HttpClient) { | |
super(http) | |
} | |
/** | |
* Execute a search - calling this consecutively will page through results | |
*/ | |
search(term: string) { |
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
import { HttpClient } from '@angular/common/http'; | |
import { Component, Input, OnDestroy, OnInit } from '@angular/core'; | |
import { Subject } from 'rxjs'; | |
import { takeUntil } from 'rxjs/operators'; | |
@Component({ | |
selector: 'hello', | |
template: `<h1>Hello!</h1>`, | |
styles: [`h1 { font-family: Lato; }`] | |
}) |
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
import { Observable, of } from "rxjs"; | |
import { switchMap, map } from "rxjs/operators"; | |
class DataFactory { | |
static getSetupData() { | |
return of({ param1: "someparam" }); | |
} | |
static getUsefulData(setupData: any) { | |
// pretend we use setupData in some fancy way |
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
import { Observable, of, Subject } from "rxjs"; | |
class DataFactory { | |
static getSetupData() { | |
return of({ param1: "someparam" }); | |
} | |
static getUsefulData(setupData: any) { | |
// pretend we use setupData in some fancy way | |
return of({ datapoint: "x" }); |
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
// returns the outermost subscription, which is not what we want. | |
someMethod(): Observable<string> { | |
return this.someService.getSetupData().subscribe(setupData => { | |
this.someOtherService.getUsefulData(setupData).subscribe(usefulData => { | |
return of(usefulData.someString); | |
}) | |
}); | |
} |
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
-- psuedo code, example. | |
INSERT INTO LocaleKeys (LocaleKey, LocaleKeyValue, Locale, Templates) VALUES N'TITLE_LOGIN', N'Login to your account', N'en-us', N'LOGIN_PAGE, SIDE_MENU' | |
INSERT INTO LocaleKeys (LocaleKey, LocaleKeyValue, Locale, Templates) VALUES N'TEXT_LOGIN', N'Already have an account? <a href="/login">Login Here</a>', N'en-us', N'LOGIN_PAGE' | |
INSERT INTO LocaleKeys (LocaleKey, LocaleKeyValue, Locale, Templates) VALUES N'APIERROR_UNKOWN', N'An unkown error happened processing your request.', N'en-us', N'*'' |
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
// For usage in Postman as Pre-Request Script to get token. | |
// Requires a environment file with 'client', 'secret', 'url' and 'authorization' key/value pairs. (leave the authorization key blank) | |
pm.sendRequest({ | |
url: pm.environment.get("url") + '/auth/token', | |
method: 'POST', | |
header: { | |
"content-type": "application/x-www-form-urlencoded" | |
}, | |
body: { |
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
// link.model.ts | |
export class Link { | |
rel: string; | |
href?: string; | |
data?: any; | |
params?: any; | |
param?: any; | |
css?: string; | |
icon: string; | |
method?: HttpMethod; |
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
user.resource = 'https://www.mysite.com/api/users/12345' | |
user.$links = [ | |
{ | |
rel: 'page', | |
href: 'https://www.mysite.com/users/12345' | |
}, | |
{ | |
rel: 'self', | |
href: 'https://www.mysite.com/api/users/12345' | |
} |
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
const User = require('../models/user.model'); | |
const moment = require('moment'); | |
class AccountStore { | |
static async register(req) { | |
let user = new User(req); | |
try { | |
return await user.save(); | |
} catch(exception) { |
NewerOlder