Skip to content

Instantly share code, notes, and snippets.

View krishnasaga's full-sized avatar
🏠
Working from home

Krishna Sagar R krishnasaga

🏠
Working from home
View GitHub Profile
import { Injectable, NestMiddleware } from '@nestjs/common';
import { Request, Response, NextFunction } from 'express';
import { OpenAPI } from 'openapi-types';
import axios from 'axios';
import { createValidatorMiddleware } from 'openapi-enforcer-middleware';
@Injectable()
export class OpenApiValidationMiddleware implements NestMiddleware {
private specifications: OpenAPI.Document[] = [];
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_timeout: 10s
rule_files:
# - "first.rules"
# - "second.rules"
scrape_configs:
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_timeout: 10s
rule_files:
# - "first.rules"
# - "second.rules"
scrape_configs:
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_timeout: 10s
rule_files:
# - "first.rules"
# - "second.rules"
scrape_configs:
@krishnasaga
krishnasaga / express-object.js
Last active December 8, 2016 10:53
JavaScript function for evolution object properties with '.' notation expression
var expressObject = function(object,string){
return string.split('.').reduce(function(a,b){
return a[b];
},object);
};
@krishnasaga
krishnasaga / flatten-function.js
Last active February 6, 2018 06:49
Flatten Array
var flatten = function(array) {
return array.reduce(function(a,b) {
return a.concat(Array.isArray(b)
? flatten(b)
: [b] );
},[]);
};