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 { Injectable } from '@angular/core'; | |
import { BehaviorSubject, Subscription, Observable } from 'rxjs'; | |
import { interval } 'rxjs/operators'; | |
@Injectable() | |
export class IntervalService { | |
private subject = new BehaviorSubject<number>(-1); | |
private subscription: Subscription; | |
readonly observable$ = this.subject.asObservable(); |
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
@echo off | |
cd /nginx | |
taskkill /f /IM nginx.exe | |
exit |
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
@echo off | |
cd /nginx | |
taskkill /f /IM nginx.exe | |
start nginx | |
exit |
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 { Injectable } from '@angular/core'; | |
import { HttpInterceptor, HttpHandler, HttpRequest } from '@angular/common/http'; | |
import { empty, TimeoutError } from 'rxjs'; | |
import { timeout, catchError } from 'rxjs/operators'; | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class RequestTimeoutHttpInterceptor implements HttpInterceptor { |
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 { NgModule } from '@angular/core'; | |
import { BrowserModule } from '@angular/platform-browser'; | |
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http'; | |
import { RequestTimeoutHttpInterceptor, DEFAULT_TIMEOUT } from './interceptors'; | |
import { AppComponent } from './app.component'; | |
@NgModule({ | |
imports: [ | |
BrowserModule, | |
HttpClientModule, |
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 java.util.Arrays; | |
/** | |
* MAX_HEAP: the root will always be the largest value | |
*/ | |
public class MaxHeap { | |
private int[] data; | |
private int size; | |
public MaxHeap(int size) { |
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
const map = ([head, ...tail], fn) => | |
typeof head === 'undefined' ? | |
[] : | |
[fn(head), ...map(tail, fn)]; | |
const reduce = ([head, ...tail], fn, value) => | |
typeof head === 'undefined' ? | |
value : | |
reduce(tail, fn, fn(value, head)); |
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
/** Person pseudo class. */ | |
const Person = (function () { | |
function Person(firstName, lastName) { | |
this.firstName = firstName; | |
this.lastName = lastName; | |
} | |
Person.prototype.alias = function () { | |
return this.firstName.charAt(0) + this.lastName.charAt(0); | |
} |
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
public class String { | |
public static boolean contains(String s, String t) { | |
for (int i = 0; i < s.length(); i++) { | |
if (s.charAt(i) == t.charAt(0)) { | |
int j = 1; | |
for (; j < t.length(); j++) { | |
if (t.charAt(j) != s.charAt(i + j)) { | |
break; | |
} |
OlderNewer