Skip to content

Instantly share code, notes, and snippets.

View tomasstankovic's full-sized avatar

Tomáš Stankovič tomasstankovic

View GitHub Profile
@tomasstankovic
tomasstankovic / helpers.less
Last active July 29, 2016 20:01
CSS text shortening. /LESS mixin/
.textLimiter(){
display: block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
@tomasstankovic
tomasstankovic / gruntfile.js
Last active July 21, 2016 13:16
Less compilation settings
production: {
options: {
plugins: [
require(‘less-plugin-glob’),
new (require(‘less-plugin-autoprefix’))({
browsers: [‘> 1%’, ‘last 2 versions’, ‘ie 9’]
}),
new (require(‘less-plugin-clean-css’))({
keepSpecialComments: false,
processImport: true,
@tomasstankovic
tomasstankovic / bem.html
Last active July 31, 2016 15:51
My BEM HTML example.
<div class="widget">
<a class="widget__social" href="#">facebook</a>
<h3 class="widget__title">Slinto Komik</h3>
<div class="widget__stats">
<a class="widget__stats-item" href="#">31 Like</a>
<a class="widget__stats-item active" href="#">140 Comment</a>
</div>
</div>
@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';
@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 / htt-service-2.ts
Created August 11, 2016 19:02
Angular 2 Http interceptor / Request interceptor
private requestInterceptor(): void {
this.loaderService.showPreloader();
}
import { Component } from '@angular/core';
import { PreloaderService } from '../../services/preloader-service';
@Component({
selector: 'preloader-full',
styleUrls: [
'./preloader-full.scss'
],
templateUrl: './preloader-full.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-small',
styleUrls: [
'./preloader-small.scss'
],
templateUrl: './preloader-small.html'
})
<div class="preloader-small"
*ngIf="preloaderService.getPreloaderCount('small') > 0 && preloaderService.getPreloaderCount('full') == 0"
></div>