Skip to content

Instantly share code, notes, and snippets.

@zkkmin
zkkmin / auth.service.ts
Created October 10, 2018 22:34
Auth service with JWT token
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Observable, of } from 'rxjs';
import { catchError, tap } from 'rxjs/operators';
import * as moment from 'moment';
const httpOptions = {
headers: new HttpHeaders({ 'Content-Type': 'application/json'})
}
@zkkmin
zkkmin / dashboard.component.html
Created October 8, 2018 22:47
Fabulous dashboard content
<h1 class="has-text-centered is-size-1">This is your dashboard, sugar!</h1>
<div class="level">
<div class="level-item">
<img src="http://1.bp.blogspot.com/-bTzYQL5GMGU/UTxKjVrQPQI/AAAAAAAAATI/AB6fJEWU-Qk/s1600/exterface_unicorn_03.jpg">
</div>
</div>
@zkkmin
zkkmin / app.component.ts
Created June 30, 2018 23:17
Calling child component's function from parent view
import { Component, ViewChild } from '@angular/core';
import { RandomQuoteComponent } from './random-quote/random-quote.component'
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
@ViewChild(RandomQuoteComponent)
import { Component, OnInit } from '@angular/core';
import { QuoteService } from '../quote.service';
@Component({
selector: 'app-random-quote',
templateUrl: './random-quote.component.html',
styleUrls: ['./random-quote.component.css']
})
export class RandomQuoteComponent implements OnInit {
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { HttpClient } from '@angular/common/http';
@Injectable({
providedIn: 'root'
})
export class QuoteService {
private quoteUrl = "https://talaikis.com/api/quotes/random/";
@zkkmin
zkkmin / app.component.html
Last active June 28, 2018 08:58
App component
<!--The content below is only a placeholder and can be replaced.-->
<section class="hero is-info is-fullheight is-bold ">
<div class="hero-head">
<app-header></app-header>
</div>
<div class="hero-body">
<div class="container has-text-centered">
<h1 class="title">
@zkkmin
zkkmin / header.component.html
Created June 28, 2018 08:52
Header component
<nav class="navbar">
<div class="navbar-brand">
<a class="navbar-item">
<img src="https://bulma.io/images/bulma-logo.png">
</a>
</div>
</nav>
@zkkmin
zkkmin / call_api_thread.py
Created May 11, 2018 04:09
Python thread
from threading import Thread
class APIThread(Thread)
def __init__(self, data):
self.data = data
Thread.__init__(self)
def run(self)
# call external api
@zkkmin
zkkmin / routes.kml
Created June 22, 2017 05:16
Sample KML file for barrier-free routes with source and destination postal codes pairs as route identification.
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http:www.opengis.net/kml/2.2">
<Document>
<Style id="redLinePoly">
<LineStyle>
<color>ff0000ff</color>
<width>4</width>
</LineStyle>
</Style>
<Placemark>