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
interface FormModelValue<V = string | number | boolean | undefined | null> { | |
value: V; | |
error: boolean; | |
} | |
type MapToModel<T> = { | |
[P in keyof T]: FormModelValue<T[P]> | |
} | |
interface Form<M> { |
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
module.exports = { | |
"env": { | |
"browser": true, | |
"es6": true, | |
"node": true, | |
"jest/globals": true | |
}, | |
"parser": "babel-eslint", | |
"extends": ["eslint:recommended"], | |
"parserOptions": { |
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
interface Interceptors { | |
request: { [k: string]: (...args: any[]) => any }; | |
response: { [k: string]: (response: Response) => any }; | |
} | |
class Interceptor { | |
protected requestCount: number = 0; | |
protected interceptors: Interceptors = { | |
request: {}, | |
response: {}, |
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 function fetchJSON(url: string, method: API_METHODS, data?: any): Promise<any> { | |
return fetch(url, { | |
method, | |
headers: { | |
'Content-Type': 'application/json', | |
}, | |
body: JSON.stringify(data), | |
}) | |
.then((res: any) => { | |
if (res.status >= 400) { |
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
/** | |
Simple automation for Docker deployment with different environment files. Essentially end result | |
is to pass a enviroment when calling the file so that the correct compose file is copied into | |
the root directory. | |
*/ | |
(function() { | |
'use strict'; | |
// imports | |
const process = require('process'); | |
const fs = require('fs'); |
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
div(id="breadcrumbs") | |
span(ng-repeat="breadcrumb in breadcrumbs") | |
#[button(ui-sref="{{breadcrumb.path}}", class="link") {{breadcrumb.name}}]/ |
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
/** | |
* generateKey ( Because I don't like to use `_id` ) | |
* Generates a unique key | |
* @param Model -> Object | |
* @param Property Name (I.E. `clientId`) -> String | |
* @return Key -> String | |
**/ | |
export function generateKey(model, propName) { | |
// Algorythm for Key | |
const keyAlgo = () => { |
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 q from 'q' | |
/******************************************************************************* | |
Create | |
*******************************************************************************/ | |
export function crudCreate ( model, body ){ | |
let dfd = q.defer() | |
new model(body).save() | |
.then(result => { | |
return dfd.resolve(result) |
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 _ from 'lodash' | |
/** | |
* Trim Response function | |
* Trim Object with given keys in Array | |
* @param obj || array of objects | |
* @param array | |
* @return obj | |
**/ |