Skip to content

Instantly share code, notes, and snippets.

@glosik
glosik / example.component.ts
Created February 5, 2021 19:21 — forked from ckimrie/example.component.ts
Example on how to achieve RxJS observable caching and storage in Angular 2+. Ideal for storing Http requests client side for offline usage.
import { Component, OnInit, OnDestroy } from '@angular/core';
import {Http} from "@angular/http";
import { LocalCacheService } from "./local-cache.service";
@Component({
selector: 'app-example',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class ExampleComponent implements OnInit, OnDestroy {
* { background-color: rgba(255,0,0,.2); }
* * { background-color: rgba(0,255,0,.2); }
* * * { background-color: rgba(0,0,255,.2); }
* * * * { background-color: rgba(255,0,255,.2); }
* * * * * { background-color: rgba(0,255,255,.2); }
* * * * * * { background-color: rgba(255,255,0,.2); }
* * * * * * * { background-color: rgba(255,0,0,.2); }
* * * * * * * * { background-color: rgba(0,255,0,.2); }
* * * * * * * * * { background-color: rgba(0,0,255,.2); }
@glosik
glosik / fxFlexFill
Created January 30, 2019 21:29
corresponding css for fxFlexFill
height: 100%;
min-height: 100%;
min-width: 100%;
width: 100%;
@glosik
glosik / image
Created November 2, 2017 22:28
optimiztion
https://developers.google.com/speed/docs/insights/OptimizeImages
convert puzzle.jpg -sampling-factor 4:2:0 -strip -quality 85 -interlace JPEG -colorspace RGB puzzle_converted.jpg
@glosik
glosik / _mixins.scss
Created August 29, 2017 15:33 — forked from garyharan/_mixins.scss
Useful scss mixins (rounded corners, gradients, text-field, button)
@mixin box-shadow($top, $left, $blur, $color, $inset: false) {
@if $inset {
-webkit-box-shadow:inset $top $left $blur $color;
-moz-box-shadow:inset $top $left $blur $color;
box-shadow:inset $top $left $blur $color;
} @else {
-webkit-box-shadow: $top $left $blur $color;
-moz-box-shadow: $top $left $blur $color;
box-shadow: $top $left $blur $color;
}
{
"@context": "http://schema.org/",
"persons":[
{
"@type": "Person",
"name": "Jaew Dor",
"jobTitle": "Deog"
},
{
"@type": "Person",
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Organization",
"address":
[
{
"@type": "PostalAddress"
},
{
@glosik
glosik / ng-bind
Created July 6, 2017 21:15
ng-content
app.directive('ngBindAttrs', function() {
return function(scope, element, attrs) {
scope.$watch(attrs.ngBindAttrs, function(value) {
angular.forEach(value, function(value, key) {
attrs.$set(key, value);
})
}, true)
}
});
@glosik
glosik / image-ratio
Created July 6, 2017 18:58
image-ratio angular
angular.module('malibuApp').directive('imageRatio', function () {
- return {
- restrict: 'A',
- link: function (scope, elem, attr) {
- elem.on('load', function () {
- var w = this.naturalWidth,
- h = this.naturalHeight;
- if (h > w) {
- $(this).addClass('portrait');
- } else {
@glosik
glosik / roboto-google-maps-prevent
Created July 5, 2017 14:41
roboto-google-maps-prevent
var head = document.getElementsByTagName('head')[0];
// Save the original method
var insertBefore = head.insertBefore;
// Replace it!
head.insertBefore = function (newElement, referenceElement) {
if (newElement.href && newElement.href.indexOf('https://fonts.googleapis.com/css?family=Roboto') === 0) {