Skip to content

Instantly share code, notes, and snippets.

View tomasstankovic's full-sized avatar

Tomáš Stankovič tomasstankovic

View GitHub Profile
@tomasstankovic
tomasstankovic / tensorflow-heroku.py
Last active May 5, 2017 16:54
tensorflow-heroku.py
from sys import platform as _platform
import numpy as np
from six.moves import urllib
import tensorflow as tf
from flask import Flask, jsonify, render_template, request
PWD = '/var/www/html/flaskapp'
MODEL_PATH = PWD + '/data/output_graph.pb'
LABELS_PATH = PWD + '/data/output_labels.txt'
import { Injectable } from '@angular/core';
import { Http, ConnectionBackend, Request, RequestOptions, RequestOptionsArgs, Response, Headers } from '@angular/http';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/throw';
import 'rxjs/Rx';
import { PreloaderService } from './preloader-service';
import { Config } from '../config';
@Injectable()
export class HttpService extends Http {
import { Injectable } from '@angular/core';
@Injectable()
export class PreloaderService {
public static fullLoadingCount: number = 0;
public static smallLoadingCount: number = 0;
getPreloaderCount(preloaderType = 'full'): number {
if (preloaderType === 'full') {
return PreloaderService.fullLoadingCount;
<div class="preloader-small"
*ngIf="preloaderService.getPreloaderCount('small') > 0 && preloaderService.getPreloaderCount('full') == 0"
></div>
import { Component } from '@angular/core';
import { PreloaderService } from '../../services/preloader-service';
@Component({
selector: 'preloader-small',
styleUrls: [
'./preloader-small.scss'
],
templateUrl: './preloader-small.html'
})
<div class="preloader-full"
*ngIf="preloaderService.getPreloaderCount('full') > 0">
<div class="preloader-full__spinner">💩</div>
</div>
import { Component } from '@angular/core';
import { PreloaderService } from '../../services/preloader-service';
@Component({
selector: 'preloader-full',
styleUrls: [
'./preloader-full.scss'
],
templateUrl: './preloader-full.html'
})
@tomasstankovic
tomasstankovic / htt-service-2.ts
Created August 11, 2016 19:02
Angular 2 Http interceptor / Request interceptor
private requestInterceptor(): void {
this.loaderService.showPreloader();
}
@tomasstankovic
tomasstankovic / http-service-1.ts
Last active August 11, 2016 19:00
Angular 2 Http interceptor / HTTP GET request
get(url: string, options?: RequestOptionsArgs): Observable<any> {
this.requestInterceptor();
return super.get(this.getFullUrl(url), this.requestOptions(options))
.catch(this.onCatch)
.do((res: Response) => {
this.onSubscribeSuccess(res);
}, (error: any) => {
this.onSubscribeError(error);
})
.finally(() => {
@tomasstankovic
tomasstankovic / http-service.ts
Last active July 22, 2017 00:33
Angular 2 Http interceptor
import { Injectable } from '@angular/core';
import {
Http,
ConnectionBackend,
RequestOptions,
RequestOptionsArgs,
Response,
Headers
} from '@angular/http';
import { Observable } from 'rxjs/Observable';