Skip to content

Instantly share code, notes, and snippets.

View ardydedase's full-sized avatar
🏠
Working from home

Ardy Gallego Dedase ardydedase

🏠
Working from home
View GitHub Profile
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);
ngOnInit() {
// this.results$ =...
this.subscriptions.push(
this.searchReposFormControl.valueChanges.subscribe((searchString) => {
if (searchString) {
this.searchType = SearchType.REPOS;
this.searchSubject$.next(searchString);
}
}),
ngOnInit() {
// this.results$ = this.searchSubject$.pipe...
this.searchReposSub = this.searchReposFormControl.valueChanges.subscribe(
(searchString) => {
if (searchString) {
this.searchType = SearchType.REPOS;
this.searchSubject$.next(searchString);
}
}
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;
/**
* Used for parsed car model info from the supported website.
*/
export class ModelParser {
private modelInfo: string;
constructor(modelInfo: string) {
this.modelInfo = modelInfo;
}
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) => {
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() {
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"
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)
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 """