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
| this.results$ = this.searchSubject$.pipe( | |
| debounceTime(200), | |
| distinctUntilChanged(), | |
| switchMap((searchString) => { | |
| if ((searchString as any).replace(/\s/g, '')) { | |
| switch (this.searchType) { | |
| case SearchType.REPOS: | |
| return this.githubService.searchRepos(searchString); | |
| case SearchType.USERS: | |
| return this.githubService.searchUsers(searchString); |
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
| ngOnInit() { | |
| // this.results$ =... | |
| this.subscriptions.push( | |
| this.searchReposFormControl.valueChanges.subscribe((searchString) => { | |
| if (searchString) { | |
| this.searchType = SearchType.REPOS; | |
| this.searchSubject$.next(searchString); | |
| } | |
| }), |
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
| ngOnInit() { | |
| // this.results$ = this.searchSubject$.pipe... | |
| this.searchReposSub = this.searchReposFormControl.valueChanges.subscribe( | |
| (searchString) => { | |
| if (searchString) { | |
| this.searchType = SearchType.REPOS; | |
| this.searchSubject$.next(searchString); | |
| } | |
| } |
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 { compatibleCars } from './compatible_cars'; | |
| import { SupportDetailsInterface, SupportYearRange, Compatibility } from './interface'; | |
| import { MODEL, MAKE, SUPPORTED_PACKAGE, ACC, COMPATIBILITY } from './constants'; | |
| // This seems to be a more generic function across websites | |
| export const makeIsSupported = (makeModel: string): boolean => { | |
| if (compatibleCars.filter(car => makeModel.includes(car['Make'])).length > 0) { | |
| return true; | |
| } | |
| return false; |
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
| /** | |
| * Used for parsed car model info from the supported website. | |
| */ | |
| export class ModelParser { | |
| private modelInfo: string; | |
| constructor(modelInfo: string) { | |
| this.modelInfo = modelInfo; | |
| } |
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 './content_script.css'; | |
| import React from 'react'; | |
| import ReactDOM from 'react-dom'; | |
| import { AutotraderCa, CurbieCa } from './websites'; | |
| import { getSupportDetails, getReferenceLink } from './car_support'; | |
| import { ModelParser } from './model_parser'; | |
| import { SupportDetailsInterface } from './interface'; | |
| import { SupportedCarUrl } from './constants'; | |
| const openPilotBadge = (supportDetails: SupportDetailsInterface) => { |
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 { makeIsSupported, yearIsSupported, getSupportYearRange } from '../car_support'; | |
| import { ModelParser } from '../model_parser'; | |
| import { Website, SupportYearRange } from '../interface'; | |
| import { MODEL } from '../constants'; | |
| import { compatibleCars } from '../compatible_cars' | |
| export class AutotraderCa implements Website { | |
| private carElts: any; | |
| private makeModelElt = 'makeModel'; | |
| constructor() { |
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
| services: | |
| - type: web | |
| name: flask-postgres-api | |
| env: python | |
| repo: https://github.com/ardydedase/flask-postgres-api.git | |
| plan: starter | |
| branch: master | |
| healthCheckPath: /healthcheck | |
| # Use ./migrations.sh when running for the first time | |
| buildCommand: "pip install -r requirements.txt && ./run-migrations.sh" |
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
| from . import db | |
| from .abc import BaseModel | |
| import datetime | |
| class User(db.Model, BaseModel): | |
| username = db.Column( | |
| db.String, primary_key=True, | |
| unique=True, nullable=False) |
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
| from sqlalchemy.exc import IntegrityError | |
| from exceptions import ResourceExists | |
| from models import User | |
| class UserRepository: | |
| @staticmethod | |
| def create(username: str, avatar_url: str) -> dict: | |
| """ Create user """ |