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
const express = require('express'); | |
const app = new Express(); | |
const cache = require('origin-cache'); | |
require('api-keys.script'); | |
const allowedOrigins = cache.get(); | |
// see full example: https://github.com/TaylorAckley/cors-app/blob/main/api/index.js | |
/** Use CORS. If RESTRICT_ORIGINS is enabled, only certain domains can call the API. **/ |
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
'use strict'; | |
const NodeCache = require('node-cache'); | |
const chalk = require('chalk'); | |
const origins = new NodeCache(); | |
const ApiKey = require('./models/api-key.model'); | |
// https://www.npmjs.com/package/node-cache | |
const cache = {}; |
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
require('dotenv').config(); | |
const request = require('request-promise'); | |
// Hoist our users array. | |
let users = []; | |
const API_ENDPOINT = `https://publicapi.knowledgeanywhere.com`; | |
const CLIENT_ID = process.env.LMS_CLIENT_ID; // Loaded from our .env file | |
const CLIENT_SECRET = process.env.LMS_CLIENT_SECRET; // Loaded from our .env file | |
const PAGE_SIZE = 1000; // How many records the API returns in a page. |
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
"use strict"; | |
var gulp = require('gulp'), | |
sass = require('gulp-sass'), | |
uglify = require('gulp-uglify'), | |
notify = require('gulp-notify'), | |
autoprefixer = require('gulp-autoprefixer'), | |
sourcemaps = require('gulp-sourcemaps'), | |
concat = require('gulp-concat'), | |
rename = require('gulp-rename'), | |
plumber = require('gulp-plumber'), |
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'*'' |
NewerOlder