This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { HttpClient, HttpErrorResponse, HttpResponse, HTTP_INTERCEPTORS } from '@angular/common/http'; | |
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; | |
import { fakeAsync, TestBed, tick } from '@angular/core/testing'; | |
import { AppConfig } from '../../services/app-config/app-config.interface'; | |
import { AppConfigService } from '../../services/app-config/app-config.service'; | |
import { MOCK_APP_CONFIG } from '../../services/app-config/mock/get-config.mock'; | |
import { RetryHttpErrorsInterceptor } from './retry-http-errors.interceptor'; | |
describe('RetryHttpErrorsInterceptor', () => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PLEASE CHECK THIS REPO WITH THE EXAMPLES THAT YOU CAN RUN: | |
https://github.com/apieceofbart/async-testing-with-jest-fake-timers-and-promises | |
// Let's say you have a function that does some async operation inside setTimeout (think of polling for data) | |
function runInterval(callback, interval = 1000) { | |
setInterval(async () => { | |
const results = await Promise.resolve(42) // this might fetch some data from server | |
callback(results) | |
}, interval) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Export Medium Reading List to CSV | |
* Based on Imrat Jn article on Medium | |
* https://medium.com/@imrat/1-trick-inbox-zero-readinglist-86964bc55df3 | |
* added titles, links | |
* tested on Firefox 67 on Windows, should also work on Safari 11.1.2 | |
* | |
* Go to the reading list, scroll as far as you can (in order to load all the posts), | |
* Put this into your console | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@function mat-color($palette-primary, $hue: default, $opacity: null) { | |
@if type-of($hue) == number and $hue >= 0 and $hue <= 1 { | |
@return mat-color($palette-primary, default, $hue); | |
} | |
$color: map-get($palette-primary, $hue); | |
$opacity: if($opacity == null, opacity($color), $opacity); | |
@if type-of($opacity) == string { | |
$new-string: str-replace($color, ')', '-alpha, 1)'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<mat-toolbar color="accent"> | |
<button mat-icon-button matTooltip="Application Menu" (click)="sidenav.toggle()"> | |
<mat-icon>settings</mat-icon> | |
</button> | |
Account Settings | |
<span style="flex: 1 1 auto;"></span> | |
<div> | |
<button mat-icon-button matTooltip="Switch Apps"> | |
<mat-icon>apps</mat-icon> | |
</button> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Karma configuration file, see link for more information | |
// https://karma-runner.github.io/0.13/config/configuration-file.html | |
process.env.CHROME_BIN = require('puppeteer').executablePath(); | |
module.exports = function (config) { | |
config.set({ | |
basePath: '', | |
frameworks: ['jasmine', '@angular/cli'], | |
plugins: [ | |
require('karma-jasmine'), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -s https://swupdate.openvpn.net/repos/repo-public.gpg | apt-key add - | |
echo "deb http://build.openvpn.net/debian/openvpn/stable xenial main" > /etc/apt/sources.list.d/openvpn-aptrepo.list | |
apt update | |
apt install -y openvpn |
v1 Online Demo: https://codesandbox.io/s/v1-angular-numeric-ljwlb
v2 Online Demo: https://codesandbox.io/s/v2-angular-numeric-3w2wr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
In JavaScript, objects can be used to serve various purposes. | |
To maximise our usage of the type system, we should assign different types to our objects depending | |
on the desired purpose. | |
In this blog post I will clarify two common purposes for objects known as records and dictionaries | |
(aka maps), and how they can both be used with regards to the type system. |
NewerOlder