This file contains 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 { IRequest } from "src/models/request-composer"; | |
import { scan } from "rxjs/operators"; | |
export const overHistoryLatest5 = | |
scan((acc: IRequest[], r: IRequest) => [r, ...acc].slice(0, 5), []); |
This file contains 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 * as React from "react"; | |
import RequestComposer from "src/models/request-composer"; | |
import { | |
overHistory, | |
IHistoricRequest, | |
overHistoryLatest5 | |
} from "src/functions/history"; | |
import { overHttp } from "src/functions/http"; | |
import { Observable } from "rxjs"; | |
import { Option } from "monas"; |
This file contains 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 { Subject } from "rxjs"; | |
import { Option } from "monas"; | |
export interface IRequest { | |
uri: string; | |
headers: { [key: string]: string }; | |
time: number; | |
} | |
export default class RequestComposer { |
This file contains 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 { useEffect, useState } from "react"; | |
import { Observable, Subscription } from "rxjs"; | |
import { tap } from 'rxjs/operators'; | |
/** | |
* Reactive Hook that returns a tuple of resolved value and error. | |
* @param { Observable<T> } observable$ | |
* @param { T } defaultValue | |
*/ | |
export function useRx<T>( |
This file contains 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
interface IRequest { | |
id: string | |
} | |
interface IResponse { | |
name: string | |
} | |
type Method = 'GET' | 'POST' | 'PUT' | 'DELETE'; | |
type None = void | |
type Extends<T, TT, Get, Else> = T extends TT ? Get : Else; |
This file contains 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 { Reducer } from 'redux'; | |
export type ReducerState<S> = { | |
[P in keyof S]: Reducer<S[P]> | |
}; | |
/* Example | |
interface IState { | |
files: string[] | |
} |
This file contains 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
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Title</title> | |
</head> | |
<body> | |
<div id="log"></div> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script> | |
<script src="http://underscorejs.org/underscore.js"></script> |
This file contains 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(global) { | |
var serviceRegistrar = {}; | |
function resolve(serviceName) { | |
if (typeof serviceRegistrar[serviceName] === 'undefined') { | |
throw new Error('Service "' + serviceName + '" cannot be instantiated.'); | |
} | |
return serviceRegistrar[serviceName]; | |
} |
NewerOlder